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] Btrfs: fix direct I/O handling of extent map errors.
Date: Sun, 21 Mar 2010 22:31:25 -0400	[thread overview]
Message-ID: <4BA6D67D.4050200@gmail.com> (raw)



Signed-off-by: jim owens <owens6336@gmail.com>
---
 fs/btrfs/dio.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/dio.c b/fs/btrfs/dio.c
index b76b227..b6934be 100644
--- a/fs/btrfs/dio.c
+++ b/fs/btrfs/dio.c
@@ -486,8 +486,13 @@ getlock:
 
 		em = btrfs_get_extent(diocb->inode, NULL, 0,
 					diocb->start, len, 0);
-		if (!em) {
-			err = -EIO;
+		if (IS_ERR(em)) {
+			err = PTR_ERR(em);
+			printk(KERN_ERR
+				"btrfs directIO fail btrfs_get_extent ino %lu "
+				"extent start %llu len %llu error %d\n",
+				diocb->inode->i_ino, diocb->start,
+				data_len, err);
 			goto fail;
 		}
 
@@ -1432,8 +1437,8 @@ static int btrfs_dio_hole_read(struct btrfs_diocb *diocb, u64 hole_len)
 	}
 fail:
 	unlock_extent(&BTRFS_I(diocb->inode)->io_tree, diocb->lockstart,
-			diocb->lockstart + hole_len - 1, GFP_NOFS);
-	diocb->lockstart += hole_len;
+			diocb->start - 1, GFP_NOFS);
+	diocb->lockstart = diocb->start;
 	return err;
 }
 
@@ -1577,8 +1582,8 @@ notfound:
 	btrfs_free_path(path);
 	if (!err && *data_len) {
 		unlock_extent(&BTRFS_I(diocb->inode)->io_tree, diocb->lockstart,
-				diocb->lockstart + *data_len - 1, GFP_NOFS);
-		diocb->lockstart += *data_len;
+				diocb->start - 1, GFP_NOFS);
+		diocb->lockstart = diocb->start;
 	}
 	return err;
 }
@@ -1601,8 +1606,9 @@ static int btrfs_dio_read_csum(struct btrfs_dio_extcb *extcb)
 
 	if (extcb->iolen & (blocksize - 1)) {
 		printk(KERN_WARNING
-			"btrfs directIO unaligned checksum for ino %lu\n",
-			extcb->diocb->inode->i_ino);
+			"btrfs directIO unaligned checksum for ino %lu "
+			"start %lld len %d\n", extcb->diocb->inode->i_ino,
+			extcb->iostart, extcb->iolen);
 		extcb->iolen &= ~(blocksize - 1);
 	}
 
-- 
1.6.3.3

                 reply	other threads:[~2010-03-22  2:31 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=4BA6D67D.4050200@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.