Commit c20bc9c6 authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Use bh_read to simplify code

The duplicating code is replaced by a generic function bh_read()
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent ec275bf9
...@@ -223,16 +223,10 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to) ...@@ -223,16 +223,10 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
if (!buffer_uptodate(bh)) { if (!buffer_uptodate(bh)) {
lock_buffer(bh); err = bh_read(bh, 0);
bh->b_end_io = end_buffer_read_sync; if (err < 0) {
get_bh(bh);
submit_bh(REQ_OP_READ, bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
err = -EIO;
goto out; goto out;
} }
} }
......
...@@ -648,6 +648,7 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo, ...@@ -648,6 +648,7 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo,
bh->b_size = block_size; bh->b_size = block_size;
off = vbo & (PAGE_SIZE - 1); off = vbo & (PAGE_SIZE - 1);
set_bh_page(bh, page, off); set_bh_page(bh, page, off);
err = bh_read(bh, 0); err = bh_read(bh, 0);
if (err < 0) if (err < 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment