[PATCH 38/40] btrfs: return a blk_status_t from btrfs_repair_one_sector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is what the submit hook returns and what the callers want anyway.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/btrfs/extent_io.c | 14 +++++++-------
 fs/btrfs/extent_io.h |  2 +-
 fs/btrfs/inode.c     |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 10fc5e4dd14a3..2fdb5d7dd51e1 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2626,7 +2626,7 @@ static bool btrfs_check_repairable(struct inode *inode,
 	return true;
 }
 
-int btrfs_repair_one_sector(struct inode *inode,
+blk_status_t btrfs_repair_one_sector(struct inode *inode,
 			    struct bio *failed_bio, u32 bio_offset,
 			    struct page *page, unsigned int pgoff,
 			    u64 start, int failed_mirror,
@@ -2649,12 +2649,12 @@ int btrfs_repair_one_sector(struct inode *inode,
 
 	failrec = btrfs_get_io_failure_record(inode, start);
 	if (IS_ERR(failrec))
-		return PTR_ERR(failrec);
+		return errno_to_blk_status(PTR_ERR(failrec));
 
 
 	if (!btrfs_check_repairable(inode, failrec, failed_mirror)) {
 		free_io_failure(failure_tree, tree, failrec);
-		return -EIO;
+		return BLK_STS_IOERR;
 	}
 
 	repair_bio = btrfs_bio_alloc(inode, 1, REQ_OP_READ);
@@ -2685,7 +2685,7 @@ int btrfs_repair_one_sector(struct inode *inode,
 		free_io_failure(failure_tree, tree, failrec);
 		bio_put(repair_bio);
 	}
-	return blk_status_to_errno(status);
+	return status;
 }
 
 static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len)
@@ -2725,7 +2725,7 @@ static blk_status_t submit_read_repair(struct inode *inode,
 	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
 	const u32 sectorsize = fs_info->sectorsize;
 	const int nr_bits = (end + 1 - start) >> fs_info->sectorsize_bits;
-	int error = 0;
+	blk_status_t error = BLK_STS_OK;
 	int i;
 
 	BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
@@ -2744,7 +2744,7 @@ static blk_status_t submit_read_repair(struct inode *inode,
 		const unsigned int offset = i * sectorsize;
 		struct extent_state *cached = NULL;
 		bool uptodate = false;
-		int ret;
+		blk_status_t ret;
 
 		if (!(error_bitmap & (1U << i))) {
 			/*
@@ -2786,7 +2786,7 @@ static blk_status_t submit_read_repair(struct inode *inode,
 				start + offset + sectorsize - 1,
 				&cached);
 	}
-	return errno_to_blk_status(error);
+	return error;
 }
 
 /* lots and lots of room for performance fixes in the end_bio funcs */
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 3f0cb1ef5fdff..0239b26d5170a 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -303,7 +303,7 @@ struct io_failure_record {
 	int failed_mirror;
 };
 
-int btrfs_repair_one_sector(struct inode *inode,
+blk_status_t btrfs_repair_one_sector(struct inode *inode,
 			    struct bio *failed_bio, u32 bio_offset,
 			    struct page *page, unsigned int pgoff,
 			    u64 start, int failed_mirror,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3f7e1779ff19f..93b3ef48cea2f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7794,14 +7794,14 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
 						 btrfs_ino(BTRFS_I(inode)),
 						 pgoff);
 			} else {
-				int ret;
+				blk_status_t ret;
 
 				ret = btrfs_repair_one_sector(inode, &bbio->bio,
 						bio_offset, bvec.bv_page, pgoff,
 						start, bbio->mirror_num,
 						submit_dio_repair_bio);
 				if (ret)
-					err = errno_to_blk_status(ret);
+					err = ret;
 			}
 			ASSERT(bio_offset + sectorsize > bio_offset);
 			bio_offset += sectorsize;
-- 
2.30.2




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux