From: Konstantin Komarov Date: Mon, 16 Jan 2023 07:41:41 +0000 (+0400) Subject: fs/ntfs3: Use bh_read to simplify code X-Git-Tag: v6.4-rc1~79^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c20bc9c6d8eb13ab1c3f8e5f8ad91466ae717d7f;p=thirdparty%2Flinux.git fs/ntfs3: Use bh_read to simplify code The duplicating code is replaced by a generic function bh_read() Signed-off-by: Konstantin Komarov --- diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index e9bdc1ff08c97..b3b72673fa5e2 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -223,16 +223,10 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to) set_buffer_uptodate(bh); if (!buffer_uptodate(bh)) { - lock_buffer(bh); - bh->b_end_io = end_buffer_read_sync; - get_bh(bh); - submit_bh(REQ_OP_READ, bh); - - wait_on_buffer(bh); - if (!buffer_uptodate(bh)) { + err = bh_read(bh, 0); + if (err < 0) { unlock_page(page); put_page(page); - err = -EIO; goto out; } } diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 3d2e4c1270e49..bb004e4765638 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -648,6 +648,7 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo, bh->b_size = block_size; off = vbo & (PAGE_SIZE - 1); set_bh_page(bh, page, off); + err = bh_read(bh, 0); if (err < 0) goto out;