diff options
author | zhangyi (F) <yi.zhang@huawei.com> | 2020-09-24 09:33:33 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-10-18 16:37:14 +0200 |
commit | 2d069c0889ef0decda7af6ecbdc63b680b767749 (patch) | |
tree | 11795ab514648fd4e5f814420e8ff4793215a6ba /fs/ext4/super.c | |
parent | ext4: introduce new metadata buffer read helpers (diff) | |
download | linux-2d069c0889ef0decda7af6ecbdc63b680b767749.tar.xz linux-2d069c0889ef0decda7af6ecbdc63b680b767749.zip |
ext4: use common helpers in all places reading metadata buffers
Revome all open codes that read metadata buffers, switch to use
ext4_read_bh_*() common helpers.
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Suggested-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20200924073337.861472-4-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to '')
-rw-r--r-- | fs/ext4/super.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4cfa95abe9dc..77492cc12807 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -212,19 +212,21 @@ int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) struct buffer_head * ext4_sb_bread(struct super_block *sb, sector_t block, int op_flags) { - struct buffer_head *bh = sb_getblk(sb, block); + struct buffer_head *bh; + int ret; + bh = sb_getblk(sb, block); if (bh == NULL) return ERR_PTR(-ENOMEM); if (ext4_buffer_uptodate(bh)) return bh; - clear_buffer_verified(bh); - ll_rw_block(REQ_OP_READ, REQ_META | op_flags, 1, &bh); - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return bh; - put_bh(bh); - return ERR_PTR(-EIO); + + ret = ext4_read_bh_lock(bh, REQ_META | op_flags, true); + if (ret) { + put_bh(bh); + return ERR_PTR(ret); + } + return bh; } static int ext4_verify_csum_type(struct super_block *sb, @@ -5176,9 +5178,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb, goto out_bdev; } journal->j_private = sb; - ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer); - wait_on_buffer(journal->j_sb_buffer); - if (!buffer_uptodate(journal->j_sb_buffer)) { + if (ext4_read_bh_lock(journal->j_sb_buffer, REQ_META | REQ_PRIO, true)) { ext4_msg(sb, KERN_ERR, "I/O error on journal device"); goto out_journal; } |