linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix direct I/O handling of extent map errors.
@ 2010-03-22  2:31 jim owens
  0 siblings, 0 replies; only message in thread
From: jim owens @ 2010-03-22  2:31 UTC (permalink / raw)
  To: linux-btrfs



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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-22  2:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-22  2:31 [PATCH] Btrfs: fix direct I/O handling of extent map errors jim owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).