diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-06-04 14:34:43 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-07-06 17:39:54 -0400 |
commit | 71dd42846ffb2bd1a90e9ac2c52df0cc2ed92307 (patch) | |
tree | 8d1780c4739c2fdb9e6f2cafa0be165463838b39 /fs/ufs | |
parent | 4b7068c8b178401637ef2fb068d6256c97d23f4a (diff) |
ufs: use the branch depth in ufs_getfrag_block()
we'd already calculated it...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/inode.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 0f0c6dfccd10..5c4a4abae652 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -465,9 +465,7 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff | |||
465 | mutex_lock(&UFS_I(inode)->truncate_mutex); | 465 | mutex_lock(&UFS_I(inode)->truncate_mutex); |
466 | 466 | ||
467 | UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment); | 467 | UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment); |
468 | if (fragment > | 468 | if (!depth) |
469 | ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb) | ||
470 | << uspi->s_fpbshift)) | ||
471 | goto abort_too_big; | 469 | goto abort_too_big; |
472 | 470 | ||
473 | err = 0; | 471 | err = 0; |
@@ -490,17 +488,17 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff | |||
490 | ufs_inode_getblock(inode, bh, x, fragment, \ | 488 | ufs_inode_getblock(inode, bh, x, fragment, \ |
491 | &err, NULL, NULL, NULL) | 489 | &err, NULL, NULL, NULL) |
492 | 490 | ||
493 | if (ptr < UFS_NDIR_FRAGMENT) { | 491 | if (depth == 1) { |
494 | bh = GET_INODE_DATABLOCK(ptr); | 492 | bh = GET_INODE_DATABLOCK(ptr); |
495 | goto out; | 493 | goto out; |
496 | } | 494 | } |
497 | ptr -= UFS_NDIR_FRAGMENT; | 495 | ptr -= UFS_NDIR_FRAGMENT; |
498 | if (ptr < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) { | 496 | if (depth == 2) { |
499 | bh = GET_INODE_PTR(UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift)); | 497 | bh = GET_INODE_PTR(UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift)); |
500 | goto get_indirect; | 498 | goto get_indirect; |
501 | } | 499 | } |
502 | ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift); | 500 | ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift); |
503 | if (ptr < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) { | 501 | if (depth == 3) { |
504 | bh = GET_INODE_PTR(UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift)); | 502 | bh = GET_INODE_PTR(UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift)); |
505 | goto get_double; | 503 | goto get_double; |
506 | } | 504 | } |