Commit a7a8447e authored by Ryusuke Konishi's avatar Ryusuke Konishi

nilfs2: simplify nilfs_mdt_freeze_buffer

nilfs_page_get_nth_block() function used in nilfs_mdt_freeze_buffer()
always returns a valid buffer head, so its validity check can be
removed.
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent 888da23c
...@@ -493,17 +493,16 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) ...@@ -493,17 +493,16 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
struct buffer_head *bh_frozen; struct buffer_head *bh_frozen;
struct page *page; struct page *page;
int blkbits = inode->i_blkbits; int blkbits = inode->i_blkbits;
int ret = -ENOMEM;
page = grab_cache_page(&shadow->frozen_data, bh->b_page->index); page = grab_cache_page(&shadow->frozen_data, bh->b_page->index);
if (!page) if (!page)
return ret; return -ENOMEM;
if (!page_has_buffers(page)) if (!page_has_buffers(page))
create_empty_buffers(page, 1 << blkbits, 0); create_empty_buffers(page, 1 << blkbits, 0);
bh_frozen = nilfs_page_get_nth_block(page, bh_offset(bh) >> blkbits); bh_frozen = nilfs_page_get_nth_block(page, bh_offset(bh) >> blkbits);
if (bh_frozen) {
if (!buffer_uptodate(bh_frozen)) if (!buffer_uptodate(bh_frozen))
nilfs_copy_buffer(bh_frozen, bh); nilfs_copy_buffer(bh_frozen, bh);
if (list_empty(&bh_frozen->b_assoc_buffers)) { if (list_empty(&bh_frozen->b_assoc_buffers)) {
...@@ -513,11 +512,10 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh) ...@@ -513,11 +512,10 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
} else { } else {
brelse(bh_frozen); /* already frozen */ brelse(bh_frozen); /* already frozen */
} }
ret = 0;
}
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
return ret; return 0;
} }
struct buffer_head * struct buffer_head *
......
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