All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim owens <owens6336@gmail.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH dio.c V2 5/6] Btrfs: remove lockend from diocb.
Date: Wed, 03 Mar 2010 13:55:20 -0500	[thread overview]
Message-ID: <4B8EB098.4050205@gmail.com> (raw)


Signed-off-by: jim owens <jim6336@gmail.com>
---
 fs/btrfs/dio.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/dio.c b/fs/btrfs/dio.c
index ad9b58f..05a7445 100644
--- a/fs/btrfs/dio.c
+++ b/fs/btrfs/dio.c
@@ -127,7 +127,6 @@ struct btrfs_diocb {
 	u64 start;			/* current submit file position */
 	u64 end;
 	u64 lockstart;
-	u64 lockend;
 	u64 begin;			/* original beginning file position */
 	u64 terminate;			/* fpos after submit/completion */
 
@@ -431,6 +430,7 @@ static void btrfs_dio_read(struct btrfs_diocb *diocb)
 {
 	struct extent_io_tree *io_tree = &BTRFS_I(diocb->inode)->io_tree;
 	u64 end = diocb->terminate; /* copy because reaper changes it */
+	u64 lockend;
 	u64 data_len;
 	int err = 0;
 	int loop = 0;
@@ -438,7 +438,7 @@ static void btrfs_dio_read(struct btrfs_diocb *diocb)
 
 	/* expand lock region to include what we read to validate checksum */
 	diocb->lockstart = diocb->start & ~(blocksize - 1);
-	diocb->lockend = ALIGN(diocb->terminate, blocksize) - 1;
+	lockend = ALIGN(end, blocksize) - 1;
 
 getlock:
 	mutex_lock(&diocb->inode->i_mutex);
@@ -446,7 +446,7 @@ getlock:
 	/* ensure writeout and btree update on everything
 	 * we might read for checksum or compressed extents
 	 */
-	data_len = diocb->lockend + 1 - diocb->lockstart;
+	data_len = lockend + 1 - diocb->lockstart;
 	err = btrfs_wait_ordered_range(diocb->inode,
 					diocb->lockstart, data_len);
 	if (err) {
@@ -464,10 +464,10 @@ getlock:
 	if (!loop) {
 		loop++;
 		diocb->terminate = end;
-		diocb->lockend = ALIGN(diocb->terminate, blocksize) - 1;
+		lockend = ALIGN(end, blocksize) - 1;
 	}
 
-	lock_extent(io_tree, diocb->lockstart, diocb->lockend, GFP_NOFS);
+	lock_extent(io_tree, diocb->lockstart, lockend, GFP_NOFS);
 	mutex_unlock(&diocb->inode->i_mutex);
 
 	data_len = end - diocb->start;
@@ -514,12 +514,12 @@ getlock:
 			} else if (test_bit(EXTENT_FLAG_COMPRESSED,
 								&em->flags)) {
 				if (diocb->lockstart > em->start ||
-				    diocb->lockend < em->start + em->len - 1) {
+				    lockend < em->start + em->len - 1) {
 					/* lock everything we read to inflate */
 					unlock_extent(io_tree, diocb->lockstart,
-						diocb->lockend, GFP_NOFS);
+						lockend, GFP_NOFS);
 					diocb->lockstart = em->start;
-					diocb->lockend = max(diocb->lockend,
+					lockend = max(lockend,
 						em->start + em->len - 1);
 					free_extent_map(em);
 					goto getlock;
@@ -545,9 +545,8 @@ fail:
 	 * range as appropriate for submitted bios, so we only
 	 * need to unlock the unprocessed remainder
 	 */
-	if (diocb->lockstart <= diocb->lockend)
-		unlock_extent(io_tree, diocb->lockstart,
-					diocb->lockend, GFP_NOFS);
+	if (diocb->lockstart <= lockend)
+		unlock_extent(io_tree, diocb->lockstart, lockend, GFP_NOFS);
 }
 
 static int btrfs_dio_new_extcb(struct btrfs_dio_extcb **alloc_extcb,
-- 
1.6.3.3

                 reply	other threads:[~2010-03-03 18:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B8EB098.4050205@gmail.com \
    --to=owens6336@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.