public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH] xfs_io: allow combination of sync_file_range() flags
Date: Mon, 18 Mar 2019 09:18:38 -0400	[thread overview]
Message-ID: <20190318131838.19019-1-bfoster@redhat.com> (raw)

The sync_file_range() functionality supports a flags argument that
allows the caller to specify any combination of initiating writeback
or waiting for write completion before and/or after the write. The
xfs_io handler supports the ability to specify combinations of flags
on the command line, but fails to OR the flags together and thus
only performs one action per invocation.

This is inconsistent with the syscall and command interpretation.
Update the sync_file_range() handler to populate the flags mask as
specified by the user.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 io/sync_file_range.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/io/sync_file_range.c b/io/sync_file_range.c
index 30bbc93d..8b5345c5 100644
--- a/io/sync_file_range.c
+++ b/io/sync_file_range.c
@@ -37,13 +37,13 @@ sync_range_f(
 	while ((c = getopt(argc, argv, "abw")) != EOF) {
 		switch (c) {
 		case 'a':
-			sync_mode = SYNC_FILE_RANGE_WAIT_AFTER;
+			sync_mode |= SYNC_FILE_RANGE_WAIT_AFTER;
 			break;
 		case 'b':
-			sync_mode = SYNC_FILE_RANGE_WAIT_BEFORE;
+			sync_mode |= SYNC_FILE_RANGE_WAIT_BEFORE;
 			break;
 		case 'w':
-			sync_mode = SYNC_FILE_RANGE_WRITE;
+			sync_mode |= SYNC_FILE_RANGE_WRITE;
 			break;
 		default:
 			return command_usage(&sync_range_cmd);
-- 
2.17.2

             reply	other threads:[~2019-03-18 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 13:18 Brian Foster [this message]
2019-03-18 15:28 ` [PATCH] xfs_io: allow combination of sync_file_range() flags 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=20190318131838.19019-1-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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