diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-13 23:48:06 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:50 -0500 |
commit | 141bbdba9c2c1592d56b019277774099a5412aea (patch) | |
tree | 253f97f5843e5d80a42c281f474a36396823d6f7 /fs/nilfs2 | |
parent | 1376e931b75f954057b1547ba25fcba594cef804 (diff) |
nilfs2: unfold nilfs_palloc_block_get_bitmap function
This expands a trivial address calculation in the function into its
every callsite. This expansion improves readability of the callers.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/alloc.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index d69e6ae59251..7e2b3ce57aa9 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c | |||
@@ -176,13 +176,6 @@ nilfs_palloc_block_get_group_desc(const struct inode *inode, | |||
176 | group % nilfs_palloc_groups_per_desc_block(inode); | 176 | group % nilfs_palloc_groups_per_desc_block(inode); |
177 | } | 177 | } |
178 | 178 | ||
179 | static unsigned char * | ||
180 | nilfs_palloc_block_get_bitmap(const struct inode *inode, | ||
181 | const struct buffer_head *bh, void *kaddr) | ||
182 | { | ||
183 | return (unsigned char *)(kaddr + bh_offset(bh)); | ||
184 | } | ||
185 | |||
186 | void *nilfs_palloc_block_get_entry(const struct inode *inode, __u64 nr, | 179 | void *nilfs_palloc_block_get_entry(const struct inode *inode, __u64 nr, |
187 | const struct buffer_head *bh, void *kaddr) | 180 | const struct buffer_head *bh, void *kaddr) |
188 | { | 181 | { |
@@ -289,8 +282,7 @@ int nilfs_palloc_prepare_alloc_entry(struct inode *inode, | |||
289 | if (ret < 0) | 282 | if (ret < 0) |
290 | goto out_desc; | 283 | goto out_desc; |
291 | bitmap_kaddr = kmap(bitmap_bh->b_page); | 284 | bitmap_kaddr = kmap(bitmap_bh->b_page); |
292 | bitmap = nilfs_palloc_block_get_bitmap( | 285 | bitmap = bitmap_kaddr + bh_offset(bitmap_bh); |
293 | inode, bitmap_bh, bitmap_kaddr); | ||
294 | pos = nilfs_palloc_find_available_slot( | 286 | pos = nilfs_palloc_find_available_slot( |
295 | inode, group, group_offset, bitmap, | 287 | inode, group, group_offset, bitmap, |
296 | entries_per_group); | 288 | entries_per_group); |
@@ -351,8 +343,7 @@ void nilfs_palloc_commit_free_entry(struct inode *inode, | |||
351 | desc = nilfs_palloc_block_get_group_desc(inode, group, | 343 | desc = nilfs_palloc_block_get_group_desc(inode, group, |
352 | req->pr_desc_bh, desc_kaddr); | 344 | req->pr_desc_bh, desc_kaddr); |
353 | bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); | 345 | bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); |
354 | bitmap = nilfs_palloc_block_get_bitmap(inode, req->pr_bitmap_bh, | 346 | bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); |
355 | bitmap_kaddr); | ||
356 | 347 | ||
357 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), | 348 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), |
358 | group_offset, bitmap)) | 349 | group_offset, bitmap)) |
@@ -385,8 +376,7 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, | |||
385 | desc = nilfs_palloc_block_get_group_desc(inode, group, | 376 | desc = nilfs_palloc_block_get_group_desc(inode, group, |
386 | req->pr_desc_bh, desc_kaddr); | 377 | req->pr_desc_bh, desc_kaddr); |
387 | bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); | 378 | bitmap_kaddr = kmap(req->pr_bitmap_bh->b_page); |
388 | bitmap = nilfs_palloc_block_get_bitmap(inode, req->pr_bitmap_bh, | 379 | bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); |
389 | bitmap_kaddr); | ||
390 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), | 380 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), |
391 | group_offset, bitmap)) | 381 | group_offset, bitmap)) |
392 | printk(KERN_WARNING "%s: entry numer %llu already freed\n", | 382 | printk(KERN_WARNING "%s: entry numer %llu already freed\n", |
@@ -472,8 +462,7 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) | |||
472 | desc = nilfs_palloc_block_get_group_desc( | 462 | desc = nilfs_palloc_block_get_group_desc( |
473 | inode, group, desc_bh, desc_kaddr); | 463 | inode, group, desc_bh, desc_kaddr); |
474 | bitmap_kaddr = kmap(bitmap_bh->b_page); | 464 | bitmap_kaddr = kmap(bitmap_bh->b_page); |
475 | bitmap = nilfs_palloc_block_get_bitmap( | 465 | bitmap = bitmap_kaddr + bh_offset(bitmap_bh); |
476 | inode, bitmap_bh, bitmap_kaddr); | ||
477 | for (j = i, n = 0; | 466 | for (j = i, n = 0; |
478 | (j < nitems) && nilfs_palloc_group_is_in(inode, group, | 467 | (j < nitems) && nilfs_palloc_group_is_in(inode, group, |
479 | entry_nrs[j]); | 468 | entry_nrs[j]); |