aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/mdt.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-12-26 10:03:02 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-01-10 00:05:46 -0500
commita7a8447edef2cfa9b28cc3892993d9fafb362671 (patch)
tree85fc226757b9e2358e226f55271566c2d0c281e8 /fs/nilfs2/mdt.c
parent888da23c2f70ca2e9897b725322a6456285ee9c4 (diff)
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: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/mdt.c')
-rw-r--r--fs/nilfs2/mdt.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index f5d4b184eaf9..6a0e2a189f60 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -493,31 +493,29 @@ int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
493 struct buffer_head *bh_frozen; 493 struct buffer_head *bh_frozen;
494 struct page *page; 494 struct page *page;
495 int blkbits = inode->i_blkbits; 495 int blkbits = inode->i_blkbits;
496 int ret = -ENOMEM;
497 496
498 page = grab_cache_page(&shadow->frozen_data, bh->b_page->index); 497 page = grab_cache_page(&shadow->frozen_data, bh->b_page->index);
499 if (!page) 498 if (!page)
500 return ret; 499 return -ENOMEM;
501 500
502 if (!page_has_buffers(page)) 501 if (!page_has_buffers(page))
503 create_empty_buffers(page, 1 << blkbits, 0); 502 create_empty_buffers(page, 1 << blkbits, 0);
504 503
505 bh_frozen = nilfs_page_get_nth_block(page, bh_offset(bh) >> blkbits); 504 bh_frozen = nilfs_page_get_nth_block(page, bh_offset(bh) >> blkbits);
506 if (bh_frozen) { 505
507 if (!buffer_uptodate(bh_frozen)) 506 if (!buffer_uptodate(bh_frozen))
508 nilfs_copy_buffer(bh_frozen, bh); 507 nilfs_copy_buffer(bh_frozen, bh);
509 if (list_empty(&bh_frozen->b_assoc_buffers)) { 508 if (list_empty(&bh_frozen->b_assoc_buffers)) {
510 list_add_tail(&bh_frozen->b_assoc_buffers, 509 list_add_tail(&bh_frozen->b_assoc_buffers,
511 &shadow->frozen_buffers); 510 &shadow->frozen_buffers);
512 set_buffer_nilfs_redirected(bh); 511 set_buffer_nilfs_redirected(bh);
513 } else { 512 } else {
514 brelse(bh_frozen); /* already frozen */ 513 brelse(bh_frozen); /* already frozen */
515 }
516 ret = 0;
517 } 514 }
515
518 unlock_page(page); 516 unlock_page(page);
519 page_cache_release(page); 517 page_cache_release(page);
520 return ret; 518 return 0;
521} 519}
522 520
523struct buffer_head * 521struct buffer_head *