* [PATCH] btrfs: submit_read_repair() cleanup
@ 2022-03-21 5:48 Qu Wenruo
2022-04-11 17:06 ` David Sterba
2022-04-13 13:46 ` Nikolay Borisov
0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2022-03-21 5:48 UTC (permalink / raw)
To: linux-btrfs
Cleanup the function submit_read_repair() by:
- Remove the fixed argument submit_bio_hook()
The function is only called on buffered data read path, so the
@submit_bio_hook argument is always btrfs_submit_data_bio().
Since it's fixed, then there is no need to pass that argument at all.
- Rename the function to submit_data_read_repair()
Just to be more explicit on all the 3 things, data, read and repair.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/extent_io.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 53b59944013f..b6f87abdbc51 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2716,12 +2716,13 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len)
btrfs_subpage_end_reader(fs_info, page, start, len);
}
-static blk_status_t submit_read_repair(struct inode *inode,
- struct bio *failed_bio, u32 bio_offset,
- struct page *page, unsigned int pgoff,
- u64 start, u64 end, int failed_mirror,
- unsigned int error_bitmap,
- submit_bio_hook_t *submit_bio_hook)
+static blk_status_t submit_data_read_repair(struct inode *inode,
+ struct bio *failed_bio,
+ u32 bio_offset, struct page *page,
+ unsigned int pgoff,
+ u64 start, u64 end,
+ int failed_mirror,
+ unsigned int error_bitmap)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
const u32 sectorsize = fs_info->sectorsize;
@@ -2731,6 +2732,9 @@ static blk_status_t submit_read_repair(struct inode *inode,
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
+ /* This repair is only for data */
+ ASSERT(is_data_inode(inode));
+
/* We're here because we had some read errors or csum mismatch */
ASSERT(error_bitmap);
@@ -2759,7 +2763,7 @@ static blk_status_t submit_read_repair(struct inode *inode,
ret = btrfs_repair_one_sector(inode, failed_bio,
bio_offset + offset,
page, pgoff + offset, start + offset,
- failed_mirror, submit_bio_hook);
+ failed_mirror, btrfs_submit_data_bio);
if (!ret) {
/*
* We have submitted the read repair, the page release
@@ -3077,13 +3081,13 @@ static void end_bio_extent_readpage(struct bio *bio)
goto readpage_ok;
/*
- * btrfs_submit_read_repair() will handle all the good
+ * submit_data_read_repair() will handle all the good
* and bad sectors, we just continue to the next bvec.
*/
- submit_read_repair(inode, bio, bio_offset, page,
- start - page_offset(page), start,
- end, mirror, error_bitmap,
- btrfs_submit_data_bio);
+ submit_data_read_repair(inode, bio, bio_offset, page,
+ start - page_offset(page),
+ start, end, mirror,
+ error_bitmap);
ASSERT(bio_offset + len > bio_offset);
bio_offset += len;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: submit_read_repair() cleanup
2022-03-21 5:48 [PATCH] btrfs: submit_read_repair() cleanup Qu Wenruo
@ 2022-04-11 17:06 ` David Sterba
2022-04-13 13:46 ` Nikolay Borisov
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-04-11 17:06 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs
On Mon, Mar 21, 2022 at 01:48:42PM +0800, Qu Wenruo wrote:
> Cleanup the function submit_read_repair() by:
>
> - Remove the fixed argument submit_bio_hook()
> The function is only called on buffered data read path, so the
> @submit_bio_hook argument is always btrfs_submit_data_bio().
>
> Since it's fixed, then there is no need to pass that argument at all.
>
> - Rename the function to submit_data_read_repair()
> Just to be more explicit on all the 3 things, data, read and repair.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: submit_read_repair() cleanup
2022-03-21 5:48 [PATCH] btrfs: submit_read_repair() cleanup Qu Wenruo
2022-04-11 17:06 ` David Sterba
@ 2022-04-13 13:46 ` Nikolay Borisov
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2022-04-13 13:46 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs
On 21.03.22 г. 7:48 ч., Qu Wenruo wrote:
> Cleanup the function submit_read_repair() by:
>
> - Remove the fixed argument submit_bio_hook()
> The function is only called on buffered data read path, so the
> @submit_bio_hook argument is always btrfs_submit_data_bio().
>
> Since it's fixed, then there is no need to pass that argument at all.
>
> - Rename the function to submit_data_read_repair()
> Just to be more explicit on all the 3 things, data, read and repair.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-13 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-21 5:48 [PATCH] btrfs: submit_read_repair() cleanup Qu Wenruo
2022-04-11 17:06 ` David Sterba
2022-04-13 13:46 ` Nikolay Borisov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox