]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_spaceman: remove unnecessary test in openfile()
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 9 Sep 2019 19:37:07 +0000 (15:37 -0400)
committerEric Sandeen <sandeen@redhat.com>
Mon, 9 Sep 2019 19:37:07 +0000 (15:37 -0400)
xfs_spaceman always records fs_path information for an open file because
spaceman requires running on XFS and it always passes a non-null fs_path
to openfile.  Therefore, openfile doesn't need the fs_path null check.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
spaceman/file.c

index 5647ca7df21519ac8d2286d5e405a2f99a83592e..29b7d9ce584bd11fc1464353e8588f75a028db4a 100644 (file)
@@ -71,16 +71,15 @@ _("%s: Not on a mounted XFS filesystem.\n"),
                return -1;
        }
 
-       if (fs_path) {
-               fsp = fs_table_lookup(path, FS_MOUNT_POINT);
-               if (!fsp) {
-                       fprintf(stderr, _("%s: cannot find mount point."),
-                               path);
-                       close(fd);
-                       return -1;
-               }
-               memcpy(fs_path, fsp, sizeof(struct fs_path));
+       fsp = fs_table_lookup(path, FS_MOUNT_POINT);
+       if (!fsp) {
+               fprintf(stderr, _("%s: cannot find mount point."),
+                       path);
+               close(fd);
+               return -1;
        }
+       memcpy(fs_path, fsp, sizeof(struct fs_path));
+
        return fd;
 }