Skip to content

Commit de57818

Browse files
committed
Merge tag 'xfs-5.1-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs cleanups from Darrick Wong: "Here's a few more cleanups that trickled in for the merge window. It's all fixes for static checker complaints and slowly unwinding typedef usage. The four patches here have gone through a few days worth of fstest runs with no new problems observed. Summary: - Fix some clang/smatch/sparse warnings about uninitialized variables. - Clean up some typedef usage" * tag 'xfs-5.1-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: clean up xfs_dir2_leaf_addname xfs: zero initialize highstale and lowstale in xfs_dir2_leaf_addname xfs: clean up xfs_dir2_leafn_add xfs: Zero initialize highstale and lowstale in xfs_dir2_leafn_add
2 parents 5160bcc + 6ef50fe commit de57818

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

fs/xfs/libxfs/xfs_dir2_leaf.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -563,43 +563,40 @@ xfs_dir3_leaf_find_entry(
563563
*/
564564
int /* error */
565565
xfs_dir2_leaf_addname(
566-
xfs_da_args_t *args) /* operation arguments */
566+
struct xfs_da_args *args) /* operation arguments */
567567
{
568+
struct xfs_dir3_icleaf_hdr leafhdr;
569+
struct xfs_trans *tp = args->trans;
568570
__be16 *bestsp; /* freespace table in leaf */
569-
int compact; /* need to compact leaves */
570-
xfs_dir2_data_hdr_t *hdr; /* data block header */
571+
__be16 *tagp; /* end of data entry */
571572
struct xfs_buf *dbp; /* data block buffer */
572-
xfs_dir2_data_entry_t *dep; /* data block entry */
573-
xfs_inode_t *dp; /* incore directory inode */
574-
xfs_dir2_data_unused_t *dup; /* data unused entry */
573+
struct xfs_buf *lbp; /* leaf's buffer */
574+
struct xfs_dir2_leaf *leaf; /* leaf structure */
575+
struct xfs_inode *dp = args->dp; /* incore directory inode */
576+
struct xfs_dir2_data_hdr *hdr; /* data block header */
577+
struct xfs_dir2_data_entry *dep; /* data block entry */
578+
struct xfs_dir2_leaf_entry *lep; /* leaf entry table pointer */
579+
struct xfs_dir2_leaf_entry *ents;
580+
struct xfs_dir2_data_unused *dup; /* data unused entry */
581+
struct xfs_dir2_leaf_tail *ltp; /* leaf tail pointer */
582+
struct xfs_dir2_data_free *bf; /* bestfree table */
583+
int compact; /* need to compact leaves */
575584
int error; /* error return value */
576585
int grown; /* allocated new data block */
577-
int highstale; /* index of next stale leaf */
586+
int highstale = 0; /* index of next stale leaf */
578587
int i; /* temporary, index */
579588
int index; /* leaf table position */
580-
struct xfs_buf *lbp; /* leaf's buffer */
581-
xfs_dir2_leaf_t *leaf; /* leaf structure */
582589
int length; /* length of new entry */
583-
xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */
584590
int lfloglow; /* low leaf logging index */
585591
int lfloghigh; /* high leaf logging index */
586-
int lowstale; /* index of prev stale leaf */
587-
xfs_dir2_leaf_tail_t *ltp; /* leaf tail pointer */
592+
int lowstale = 0; /* index of prev stale leaf */
588593
int needbytes; /* leaf block bytes needed */
589594
int needlog; /* need to log data header */
590595
int needscan; /* need to rescan data free */
591-
__be16 *tagp; /* end of data entry */
592-
xfs_trans_t *tp; /* transaction pointer */
593596
xfs_dir2_db_t use_block; /* data block number */
594-
struct xfs_dir2_data_free *bf; /* bestfree table */
595-
struct xfs_dir2_leaf_entry *ents;
596-
struct xfs_dir3_icleaf_hdr leafhdr;
597597

598598
trace_xfs_dir2_leaf_addname(args);
599599

600-
dp = args->dp;
601-
tp = args->trans;
602-
603600
error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
604601
if (error)
605602
return error;

fs/xfs/libxfs/xfs_dir2_node.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -426,24 +426,22 @@ xfs_dir2_leaf_to_node(
426426
static int /* error */
427427
xfs_dir2_leafn_add(
428428
struct xfs_buf *bp, /* leaf buffer */
429-
xfs_da_args_t *args, /* operation arguments */
429+
struct xfs_da_args *args, /* operation arguments */
430430
int index) /* insertion pt for new entry */
431431
{
432+
struct xfs_dir3_icleaf_hdr leafhdr;
433+
struct xfs_inode *dp = args->dp;
434+
struct xfs_dir2_leaf *leaf = bp->b_addr;
435+
struct xfs_dir2_leaf_entry *lep;
436+
struct xfs_dir2_leaf_entry *ents;
432437
int compact; /* compacting stale leaves */
433-
xfs_inode_t *dp; /* incore directory inode */
434-
int highstale; /* next stale entry */
435-
xfs_dir2_leaf_t *leaf; /* leaf structure */
436-
xfs_dir2_leaf_entry_t *lep; /* leaf entry */
438+
int highstale = 0; /* next stale entry */
437439
int lfloghigh; /* high leaf entry logging */
438440
int lfloglow; /* low leaf entry logging */
439-
int lowstale; /* previous stale entry */
440-
struct xfs_dir3_icleaf_hdr leafhdr;
441-
struct xfs_dir2_leaf_entry *ents;
441+
int lowstale = 0; /* previous stale entry */
442442

443443
trace_xfs_dir2_leafn_add(args, index);
444444

445-
dp = args->dp;
446-
leaf = bp->b_addr;
447445
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
448446
ents = dp->d_ops->leaf_ents_p(leaf);
449447

0 commit comments

Comments
 (0)