diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-02-22 12:26:17 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 00:58:04 -0500 |
commit | 9954e7af14868b8b79e76b7b88daaf0b3866db33 (patch) | |
tree | 562b473d974ee6715cff8732e518a9e187c50d38 /fs/nilfs2 | |
parent | 25b18d39cca207f8559af1aac00313deda2d652e (diff) |
nilfs2: add free entries count only if clear bit operation succeeded
Three functions of the current persistent object allocator,
nilfs_palloc_commit_free_entry, nilfs_palloc_abort_alloc_entry, and
nilfs_palloc_freev functions unconditionally add a counter after doing
clear bit operation on a bitmap block.
If the clear bit operation overlapped, the counter will not add up.
This fixes the issue by making the counter operations conditional.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/alloc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index d7fd696e595c..0a0a66d98cce 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c | |||
@@ -521,8 +521,8 @@ void nilfs_palloc_commit_free_entry(struct inode *inode, | |||
521 | group_offset, bitmap)) | 521 | group_offset, bitmap)) |
522 | printk(KERN_WARNING "%s: entry number %llu already freed\n", | 522 | printk(KERN_WARNING "%s: entry number %llu already freed\n", |
523 | __func__, (unsigned long long)req->pr_entry_nr); | 523 | __func__, (unsigned long long)req->pr_entry_nr); |
524 | 524 | else | |
525 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); | 525 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); |
526 | 526 | ||
527 | kunmap(req->pr_bitmap_bh->b_page); | 527 | kunmap(req->pr_bitmap_bh->b_page); |
528 | kunmap(req->pr_desc_bh->b_page); | 528 | kunmap(req->pr_desc_bh->b_page); |
@@ -558,8 +558,8 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, | |||
558 | group_offset, bitmap)) | 558 | group_offset, bitmap)) |
559 | printk(KERN_WARNING "%s: entry number %llu already freed\n", | 559 | printk(KERN_WARNING "%s: entry number %llu already freed\n", |
560 | __func__, (unsigned long long)req->pr_entry_nr); | 560 | __func__, (unsigned long long)req->pr_entry_nr); |
561 | 561 | else | |
562 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); | 562 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); |
563 | 563 | ||
564 | kunmap(req->pr_bitmap_bh->b_page); | 564 | kunmap(req->pr_bitmap_bh->b_page); |
565 | kunmap(req->pr_desc_bh->b_page); | 565 | kunmap(req->pr_desc_bh->b_page); |
@@ -665,7 +665,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) | |||
665 | for (j = i, n = 0; | 665 | for (j = i, n = 0; |
666 | (j < nitems) && nilfs_palloc_group_is_in(inode, group, | 666 | (j < nitems) && nilfs_palloc_group_is_in(inode, group, |
667 | entry_nrs[j]); | 667 | entry_nrs[j]); |
668 | j++, n++) { | 668 | j++) { |
669 | nilfs_palloc_group(inode, entry_nrs[j], &group_offset); | 669 | nilfs_palloc_group(inode, entry_nrs[j], &group_offset); |
670 | if (!nilfs_clear_bit_atomic( | 670 | if (!nilfs_clear_bit_atomic( |
671 | nilfs_mdt_bgl_lock(inode, group), | 671 | nilfs_mdt_bgl_lock(inode, group), |
@@ -674,6 +674,8 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) | |||
674 | "%s: entry number %llu already freed\n", | 674 | "%s: entry number %llu already freed\n", |
675 | __func__, | 675 | __func__, |
676 | (unsigned long long)entry_nrs[j]); | 676 | (unsigned long long)entry_nrs[j]); |
677 | } else { | ||
678 | n++; | ||
677 | } | 679 | } |
678 | } | 680 | } |
679 | nilfs_palloc_group_desc_add_entries(inode, group, desc, n); | 681 | nilfs_palloc_group_desc_add_entries(inode, group, desc, n); |