xfs: remove unused calculation in xfs_dir2_sf_addname()
The "add_entsize" calculated here is never used. "incr_isize" accounts for the inode expansion of the old entries + parent + new entry all by itself. Once we've removed add_entsize there, it's just a pointless intermediate variable elsewhere, so remove it. For that matter, old_isize is gratuitous too, so nuke that. And add a few comments so the magic "+1's" and "+2's" make a bit more sense. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
e5e98bc64d
commit
5e06d14894
1 changed files with 7 additions and 14 deletions
|
@ -285,14 +285,12 @@ int /* error */
|
||||||
xfs_dir2_sf_addname(
|
xfs_dir2_sf_addname(
|
||||||
xfs_da_args_t *args) /* operation arguments */
|
xfs_da_args_t *args) /* operation arguments */
|
||||||
{
|
{
|
||||||
int add_entsize; /* size of the new entry */
|
|
||||||
xfs_inode_t *dp; /* incore directory inode */
|
xfs_inode_t *dp; /* incore directory inode */
|
||||||
int error; /* error return value */
|
int error; /* error return value */
|
||||||
int incr_isize; /* total change in size */
|
int incr_isize; /* total change in size */
|
||||||
int new_isize; /* di_size after adding name */
|
int new_isize; /* di_size after adding name */
|
||||||
int objchange; /* changing to 8-byte inodes */
|
int objchange; /* changing to 8-byte inodes */
|
||||||
xfs_dir2_data_aoff_t offset = 0; /* offset for new entry */
|
xfs_dir2_data_aoff_t offset = 0; /* offset for new entry */
|
||||||
int old_isize; /* di_size before adding name */
|
|
||||||
int pick; /* which algorithm to use */
|
int pick; /* which algorithm to use */
|
||||||
xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
|
xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
|
||||||
xfs_dir2_sf_entry_t *sfep = NULL; /* shortform entry */
|
xfs_dir2_sf_entry_t *sfep = NULL; /* shortform entry */
|
||||||
|
@ -316,8 +314,7 @@ xfs_dir2_sf_addname(
|
||||||
/*
|
/*
|
||||||
* Compute entry (and change in) size.
|
* Compute entry (and change in) size.
|
||||||
*/
|
*/
|
||||||
add_entsize = dp->d_ops->sf_entsize(sfp, args->namelen);
|
incr_isize = dp->d_ops->sf_entsize(sfp, args->namelen);
|
||||||
incr_isize = add_entsize;
|
|
||||||
objchange = 0;
|
objchange = 0;
|
||||||
#if XFS_BIG_INUMS
|
#if XFS_BIG_INUMS
|
||||||
/*
|
/*
|
||||||
|
@ -325,11 +322,8 @@ xfs_dir2_sf_addname(
|
||||||
*/
|
*/
|
||||||
if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->i8count == 0) {
|
if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->i8count == 0) {
|
||||||
/*
|
/*
|
||||||
* Yes, adjust the entry size and the total size.
|
* Yes, adjust the inode size. old count + (parent + new)
|
||||||
*/
|
*/
|
||||||
add_entsize +=
|
|
||||||
(uint)sizeof(xfs_dir2_ino8_t) -
|
|
||||||
(uint)sizeof(xfs_dir2_ino4_t);
|
|
||||||
incr_isize +=
|
incr_isize +=
|
||||||
(sfp->count + 2) *
|
(sfp->count + 2) *
|
||||||
((uint)sizeof(xfs_dir2_ino8_t) -
|
((uint)sizeof(xfs_dir2_ino8_t) -
|
||||||
|
@ -337,8 +331,7 @@ xfs_dir2_sf_addname(
|
||||||
objchange = 1;
|
objchange = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
old_isize = (int)dp->i_d.di_size;
|
new_isize = (int)dp->i_d.di_size + incr_isize;
|
||||||
new_isize = old_isize + incr_isize;
|
|
||||||
/*
|
/*
|
||||||
* Won't fit as shortform any more (due to size),
|
* Won't fit as shortform any more (due to size),
|
||||||
* or the pick routine says it won't (due to offset values).
|
* or the pick routine says it won't (due to offset values).
|
||||||
|
@ -1110,9 +1103,9 @@ xfs_dir2_sf_toino4(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert from 4-byte inode numbers to 8-byte inode numbers.
|
* Convert existing entries from 4-byte inode numbers to 8-byte inode numbers.
|
||||||
* The new 8-byte inode number is not there yet, we leave with the
|
* The new entry w/ an 8-byte inode number is not there yet; we leave with
|
||||||
* count 1 but no corresponding entry.
|
* i8count set to 1, but no corresponding 8-byte entry.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
xfs_dir2_sf_toino8(
|
xfs_dir2_sf_toino8(
|
||||||
|
@ -1145,7 +1138,7 @@ xfs_dir2_sf_toino8(
|
||||||
ASSERT(oldsfp->i8count == 0);
|
ASSERT(oldsfp->i8count == 0);
|
||||||
memcpy(buf, oldsfp, oldsize);
|
memcpy(buf, oldsfp, oldsize);
|
||||||
/*
|
/*
|
||||||
* Compute the new inode size.
|
* Compute the new inode size (nb: entry count + 1 for parent)
|
||||||
*/
|
*/
|
||||||
newsize =
|
newsize =
|
||||||
oldsize +
|
oldsize +
|
||||||
|
|
Loading…
Add table
Reference in a new issue