summaryrefslogtreecommitdiff
path: root/fs/ufs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-06-19 21:08:16 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-07-07 00:40:02 +0300
commit4eeff4c9326878ff58ef6fe68d2bf22ef877e5a2 (patch)
tree5e79a2c9ddcfb213effaf2b0f60087569bf2a69e /fs/ufs
parent5336970be09becb2b59ac3812718b2cb80d33347 (diff)
downloadlinux-4eeff4c9326878ff58ef6fe68d2bf22ef877e5a2.tar.xz
ufs_getfrag_block(): turn following indirects into a loop
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/inode.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index c05cf14ef8ff..f2d8cc2166af 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -444,37 +444,21 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
if (depth == 1) {
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
&err, &phys, &new, bh_result->b_page);
- if (phys64) {
- phys64 += frag;
- phys = phys64;
- }
- goto out;
- }
- if (depth == 2) {
- phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
- &err, NULL, NULL, bh_result->b_page);
- goto get_indirect;
- }
- if (depth == 3) {
+ } else {
+ int i;
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
&err, NULL, NULL, bh_result->b_page);
- goto get_double;
+ for (i = 1; i < depth - 1; i++)
+ phys64 = ufs_inode_getblock(inode, phys64, offsets[i],
+ fragment, &err, NULL, NULL, NULL);
+ phys64 = ufs_inode_getblock(inode, phys64, offsets[depth - 1],
+ fragment, &err, &phys, &new, bh_result->b_page);
}
- phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
- &err, NULL, NULL, bh_result->b_page);
- phys64 = ufs_inode_getblock(inode, phys64, offsets[1],
- fragment, &err, NULL, NULL, NULL);
-get_double:
- phys64 = ufs_inode_getblock(inode, phys64, offsets[depth - 2],
- fragment, &err, NULL, NULL, NULL);
-get_indirect:
- phys64 = ufs_inode_getblock(inode, phys64, offsets[depth - 1],
- fragment, &err, &phys, &new, bh_result->b_page);
+out:
if (phys64) {
phys64 += frag;
phys = phys64;
}
-out:
if (err)
goto abort;
if (new)