diff mbox series

[2/4] xfs_spaceman: remove unnecessary test in openfile()

Message ID 156685443266.2839773.7040997802535169869.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfs_spaceman: use runtime support library | expand

Commit Message

Darrick J. Wong Aug. 26, 2019, 9:20 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 spaceman/file.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Comments

Dave Chinner Aug. 27, 2019, 5:02 a.m. UTC | #1
On Mon, Aug 26, 2019 at 02:20:32PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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>

*nod*

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/spaceman/file.c b/spaceman/file.c
index 1264bdae..5665da7d 100644
--- a/spaceman/file.c
+++ b/spaceman/file.c
@@ -68,16 +68,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;
 }