diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-06-19 00:32:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-07-06 17:39:56 -0400 |
commit | 8d9dcf14367388674f4d792f494e6f1d6536ac95 (patch) | |
tree | 6164190f8f25412700bb8d7dedae19afe7fe6cca /fs/ufs | |
parent | bbb3eb9d3432ce55a620778ecf5670fa7942090e (diff) |
ufs_getfrag_block(): get rid of macro jungles
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/inode.c | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index d65a89030c91..156ba3c26906 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -465,49 +465,42 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff | |||
465 | err = 0; | 465 | err = 0; |
466 | ptr = fragment; | 466 | ptr = fragment; |
467 | 467 | ||
468 | /* | ||
469 | * ok, these macros clean the logic up a bit and make | ||
470 | * it much more readable: | ||
471 | */ | ||
472 | #define GET_INODE_DATABLOCK(x) \ | ||
473 | ufs_inode_getfrag(inode, x, fragment, 1, &err, &phys, &new,\ | ||
474 | bh_result->b_page) | ||
475 | #define GET_INODE_PTR(x) \ | ||
476 | ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, NULL, NULL,\ | ||
477 | bh_result->b_page) | ||
478 | #define GET_INDIRECT_DATABLOCK(x) \ | ||
479 | ufs_inode_getblock(inode, bh, x, fragment, \ | ||
480 | &err, &phys, &new, bh_result->b_page) | ||
481 | #define GET_INDIRECT_PTR(x) \ | ||
482 | ufs_inode_getblock(inode, bh, x, fragment, \ | ||
483 | &err, NULL, NULL, NULL) | ||
484 | |||
485 | if (depth == 1) { | 468 | if (depth == 1) { |
486 | bh = GET_INODE_DATABLOCK(ptr); | 469 | bh = ufs_inode_getfrag(inode, ptr, fragment, 1, &err, &phys, |
470 | &new, bh_result->b_page); | ||
487 | goto out; | 471 | goto out; |
488 | } | 472 | } |
489 | ptr -= UFS_NDIR_FRAGMENT; | 473 | ptr -= UFS_NDIR_FRAGMENT; |
490 | if (depth == 2) { | 474 | if (depth == 2) { |
491 | bh = GET_INODE_PTR(UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift)); | 475 | bh = ufs_inode_getfrag(inode, |
476 | UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift), | ||
477 | fragment, uspi->s_fpb, &err, NULL, NULL, | ||
478 | bh_result->b_page); | ||
492 | goto get_indirect; | 479 | goto get_indirect; |
493 | } | 480 | } |
494 | ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift); | 481 | ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift); |
495 | if (depth == 3) { | 482 | if (depth == 3) { |
496 | bh = GET_INODE_PTR(UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift)); | 483 | bh = ufs_inode_getfrag(inode, |
484 | UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift), | ||
485 | fragment, uspi->s_fpb, &err, NULL, NULL, | ||
486 | bh_result->b_page); | ||
497 | goto get_double; | 487 | goto get_double; |
498 | } | 488 | } |
499 | ptr -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift); | 489 | ptr -= 1 << (uspi->s_2apbshift + uspi->s_fpbshift); |
500 | bh = GET_INODE_PTR(UFS_TIND_FRAGMENT + (ptr >> uspi->s_3apbshift)); | 490 | bh = ufs_inode_getfrag(inode, |
501 | bh = GET_INDIRECT_PTR((ptr >> uspi->s_2apbshift) & uspi->s_apbmask); | 491 | UFS_TIND_FRAGMENT + (ptr >> uspi->s_3apbshift), |
492 | fragment, uspi->s_fpb, &err, NULL, NULL, | ||
493 | bh_result->b_page); | ||
494 | bh = ufs_inode_getblock(inode, bh, | ||
495 | (ptr >> uspi->s_2apbshift) & uspi->s_apbmask, | ||
496 | fragment, &err, NULL, NULL, NULL); | ||
502 | get_double: | 497 | get_double: |
503 | bh = GET_INDIRECT_PTR((ptr >> uspi->s_apbshift) & uspi->s_apbmask); | 498 | bh = ufs_inode_getblock(inode, bh, |
499 | (ptr >> uspi->s_apbshift) & uspi->s_apbmask, | ||
500 | fragment, &err, NULL, NULL, NULL); | ||
504 | get_indirect: | 501 | get_indirect: |
505 | bh = GET_INDIRECT_DATABLOCK(ptr & uspi->s_apbmask); | 502 | bh = ufs_inode_getblock(inode, bh, ptr & uspi->s_apbmask, fragment, |
506 | 503 | &err, &phys, &new, bh_result->b_page); | |
507 | #undef GET_INODE_DATABLOCK | ||
508 | #undef GET_INODE_PTR | ||
509 | #undef GET_INDIRECT_DATABLOCK | ||
510 | #undef GET_INDIRECT_PTR | ||
511 | 504 | ||
512 | out: | 505 | out: |
513 | if (err) | 506 | if (err) |