linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/4] xfs_spaceman: remove unnecessary test in openfile()
Date: Mon, 26 Aug 2019 14:20:32 -0700	[thread overview]
Message-ID: <156685443266.2839773.7040997802535169869.stgit@magnolia> (raw)
In-Reply-To: <156685442011.2839773.2684103942714886186.stgit@magnolia>

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(-)


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;
 }
 


  parent reply	other threads:[~2019-08-26 21:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 21:20 [PATCH 0/4] xfs_spaceman: use runtime support library Darrick J. Wong
2019-08-26 21:20 ` [PATCH 1/4] xfs_spaceman: remove typedef usage Darrick J. Wong
2019-08-27  5:01   ` Dave Chinner
2019-08-26 21:20 ` Darrick J. Wong [this message]
2019-08-27  5:02   ` [PATCH 2/4] xfs_spaceman: remove unnecessary test in openfile() Dave Chinner
2019-08-26 21:20 ` [PATCH 3/4] xfs_spaceman: embed struct xfs_fd in struct fileio Darrick J. Wong
2019-08-27  5:06   ` Dave Chinner
2019-08-27  5:12     ` Darrick J. Wong
2019-08-27  7:51   ` Dave Chinner
2019-08-26 21:20 ` [PATCH 4/4] xfs_spaceman: convert open-coded unit conversions to helpers Darrick J. Wong
2019-08-27  8:15   ` Dave Chinner
2019-08-29  3:48     ` Darrick J. Wong
2019-09-04  4:38 [PATCH v2 0/4] xfs_spaceman: use runtime support library Darrick J. Wong
2019-09-04  4:38 ` [PATCH 2/4] xfs_spaceman: remove unnecessary test in openfile() Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156685443266.2839773.7040997802535169869.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).