aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2014-04-14 05:07:23 -0400
committerDave Chinner <david@fromorbit.com>2014-04-14 05:07:23 -0400
commit5e06d148949bb79af429c46afb4b81bc31308f6e (patch)
tree19b06d2e1190627c989a6e0a000bfeb6b59229d1 /fs/xfs
parente5e98bc64df122c3c0fb562c53dac5c5dfc64975 (diff)
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_dir2_sf.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 3725fb1b902b..7aab8ec117ad 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -285,14 +285,12 @@ int /* error */
285xfs_dir2_sf_addname( 285xfs_dir2_sf_addname(
286 xfs_da_args_t *args) /* operation arguments */ 286 xfs_da_args_t *args) /* operation arguments */
287{ 287{
288 int add_entsize; /* size of the new entry */
289 xfs_inode_t *dp; /* incore directory inode */ 288 xfs_inode_t *dp; /* incore directory inode */
290 int error; /* error return value */ 289 int error; /* error return value */
291 int incr_isize; /* total change in size */ 290 int incr_isize; /* total change in size */
292 int new_isize; /* di_size after adding name */ 291 int new_isize; /* di_size after adding name */
293 int objchange; /* changing to 8-byte inodes */ 292 int objchange; /* changing to 8-byte inodes */
294 xfs_dir2_data_aoff_t offset = 0; /* offset for new entry */ 293 xfs_dir2_data_aoff_t offset = 0; /* offset for new entry */
295 int old_isize; /* di_size before adding name */
296 int pick; /* which algorithm to use */ 294 int pick; /* which algorithm to use */
297 xfs_dir2_sf_hdr_t *sfp; /* shortform structure */ 295 xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
298 xfs_dir2_sf_entry_t *sfep = NULL; /* shortform entry */ 296 xfs_dir2_sf_entry_t *sfep = NULL; /* shortform entry */
@@ -316,8 +314,7 @@ xfs_dir2_sf_addname(
316 /* 314 /*
317 * Compute entry (and change in) size. 315 * Compute entry (and change in) size.
318 */ 316 */
319 add_entsize = dp->d_ops->sf_entsize(sfp, args->namelen); 317 incr_isize = dp->d_ops->sf_entsize(sfp, args->namelen);
320 incr_isize = add_entsize;
321 objchange = 0; 318 objchange = 0;
322#if XFS_BIG_INUMS 319#if XFS_BIG_INUMS
323 /* 320 /*
@@ -325,11 +322,8 @@ xfs_dir2_sf_addname(
325 */ 322 */
326 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->i8count == 0) { 323 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && sfp->i8count == 0) {
327 /* 324 /*
328 * Yes, adjust the entry size and the total size. 325 * Yes, adjust the inode size. old count + (parent + new)
329 */ 326 */
330 add_entsize +=
331 (uint)sizeof(xfs_dir2_ino8_t) -
332 (uint)sizeof(xfs_dir2_ino4_t);
333 incr_isize += 327 incr_isize +=
334 (sfp->count + 2) * 328 (sfp->count + 2) *
335 ((uint)sizeof(xfs_dir2_ino8_t) - 329 ((uint)sizeof(xfs_dir2_ino8_t) -
@@ -337,8 +331,7 @@ xfs_dir2_sf_addname(
337 objchange = 1; 331 objchange = 1;
338 } 332 }
339#endif 333#endif
340 old_isize = (int)dp->i_d.di_size; 334 new_isize = (int)dp->i_d.di_size + incr_isize;
341 new_isize = old_isize + incr_isize;
342 /* 335 /*
343 * Won't fit as shortform any more (due to size), 336 * Won't fit as shortform any more (due to size),
344 * or the pick routine says it won't (due to offset values). 337 * or the pick routine says it won't (due to offset values).
@@ -1110,9 +1103,9 @@ xfs_dir2_sf_toino4(
1110} 1103}
1111 1104
1112/* 1105/*
1113 * Convert from 4-byte inode numbers to 8-byte inode numbers. 1106 * Convert existing entries from 4-byte inode numbers to 8-byte inode numbers.
1114 * The new 8-byte inode number is not there yet, we leave with the 1107 * The new entry w/ an 8-byte inode number is not there yet; we leave with
1115 * count 1 but no corresponding entry. 1108 * i8count set to 1, but no corresponding 8-byte entry.
1116 */ 1109 */
1117static void 1110static void
1118xfs_dir2_sf_toino8( 1111xfs_dir2_sf_toino8(
@@ -1145,7 +1138,7 @@ xfs_dir2_sf_toino8(
1145 ASSERT(oldsfp->i8count == 0); 1138 ASSERT(oldsfp->i8count == 0);
1146 memcpy(buf, oldsfp, oldsize); 1139 memcpy(buf, oldsfp, oldsize);
1147 /* 1140 /*
1148 * Compute the new inode size. 1141 * Compute the new inode size (nb: entry count + 1 for parent)
1149 */ 1142 */
1150 newsize = 1143 newsize =
1151 oldsize + 1144 oldsize +