提交 4eeff4c9 编写于 作者: A Al Viro

ufs_getfrag_block(): turn following indirects into a loop

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 5336970b
...@@ -444,37 +444,21 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff ...@@ -444,37 +444,21 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
if (depth == 1) { if (depth == 1) {
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment, phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
&err, &phys, &new, bh_result->b_page); &err, &phys, &new, bh_result->b_page);
if (phys64) { } else {
phys64 += frag; int i;
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) {
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
&err, NULL, NULL, bh_result->b_page);
goto get_double;
}
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment, phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
&err, NULL, NULL, bh_result->b_page); &err, NULL, NULL, bh_result->b_page);
phys64 = ufs_inode_getblock(inode, phys64, offsets[1], for (i = 1; i < depth - 1; i++)
phys64 = ufs_inode_getblock(inode, phys64, offsets[i],
fragment, &err, NULL, NULL, NULL); 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], phys64 = ufs_inode_getblock(inode, phys64, offsets[depth - 1],
fragment, &err, &phys, &new, bh_result->b_page); fragment, &err, &phys, &new, bh_result->b_page);
}
out:
if (phys64) { if (phys64) {
phys64 += frag; phys64 += frag;
phys = phys64; phys = phys64;
} }
out:
if (err) if (err)
goto abort; goto abort;
if (new) if (new)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册