* [PATCH] xfs_io: allow combination of sync_file_range() flags
@ 2019-03-18 13:18 Brian Foster
2019-03-18 15:28 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Brian Foster @ 2019-03-18 13:18 UTC (permalink / raw)
To: linux-xfs
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs_io: allow combination of sync_file_range() flags
2019-03-18 13:18 [PATCH] xfs_io: allow combination of sync_file_range() flags Brian Foster
@ 2019-03-18 15:28 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2019-03-18 15:28 UTC (permalink / raw)
To: Brian Foster; +Cc: linux-xfs
On Mon, Mar 18, 2019 at 09:18:38AM -0400, Brian Foster wrote:
> 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>
Makes sens... oh wait, this is sync_file_range, what a trash fire! :(
The arg processing changes look ok though.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-18 15:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-18 13:18 [PATCH] xfs_io: allow combination of sync_file_range() flags Brian Foster
2019-03-18 15:28 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox