Re: [PATCH] xfs: fix up the comment in xfs_dir2_isleaf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave Chinner <david@xxxxxxxxxxxxx> 于2022年9月12日周一 06:20写道:
>
> The "*vp" parameter should be a "bool *isleaf", in which case the
> return value is obvious and the comment can be removed. Then the
> logic in the function can be cleaned up to be obvious instead of
> relying on easy to mistake conditional logic in assignemnts...

Thanks for the suggestion.In order to make sure we are at the same page,
so this change will be shown like:
====
 xfs_dir2_isblock(
        struct xfs_da_args      *args,
-       int                     *vp)    /* out: 1 is block, 0 is not block */
+       bool                    *isblock)
 {
        xfs_fileoff_t           last;   /* last file offset */
        int                     rval;

        if ((rval = xfs_bmap_last_offset(args->dp, &last, XFS_DATA_FORK)))
                return rval;
-       rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
+       *isblock = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
        if (XFS_IS_CORRUPT(args->dp->i_mount,
-                          rval != 0 &&
+                          *isblock &&
                           args->dp->i_disk_size != args->geo->blksize))
                return -EFSCORRUPTED;
-       *vp = rval;
        return 0;
 }
====

Thanks,

Stephen.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux