summaryrefslogtreecommitdiffstats
path: root/fs/ufs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-06-04 14:34:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-07-06 17:39:54 -0400
commit71dd42846ffb2bd1a90e9ac2c52df0cc2ed92307 (patch)
tree8d1780c4739c2fdb9e6f2cafa0be165463838b39 /fs/ufs/inode.c
parent4b7068c8b178401637ef2fb068d6256c97d23f4a (diff)
downloadlinux-stable-71dd42846ffb2bd1a90e9ac2c52df0cc2ed92307.tar.gz
linux-stable-71dd42846ffb2bd1a90e9ac2c52df0cc2ed92307.tar.bz2
linux-stable-71dd42846ffb2bd1a90e9ac2c52df0cc2ed92307.zip
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/inode.c')
-rw-r--r--fs/ufs/inode.c10
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
mutex_lock(&UFS_I(inode)->truncate_mutex);
UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment);
- if (fragment >
- ((UFS_NDADDR + uspi->s_apb + uspi->s_2apb + uspi->s_3apb)
- << uspi->s_fpbshift))
+ if (!depth)
goto abort_too_big;
err = 0;
@@ -490,17 +488,17 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
ufs_inode_getblock(inode, bh, x, fragment, \
&err, NULL, NULL, NULL)
- if (ptr < UFS_NDIR_FRAGMENT) {
+ if (depth == 1) {
bh = GET_INODE_DATABLOCK(ptr);
goto out;
}
ptr -= UFS_NDIR_FRAGMENT;
- if (ptr < (1 << (uspi->s_apbshift + uspi->s_fpbshift))) {
+ if (depth == 2) {
bh = GET_INODE_PTR(UFS_IND_FRAGMENT + (ptr >> uspi->s_apbshift));
goto get_indirect;
}
ptr -= 1 << (uspi->s_apbshift + uspi->s_fpbshift);
- if (ptr < (1 << (uspi->s_2apbshift + uspi->s_fpbshift))) {
+ if (depth == 3) {
bh = GET_INODE_PTR(UFS_DIND_FRAGMENT + (ptr >> uspi->s_2apbshift));
goto get_double;
}