From patchwork Mon Mar 18 13:18:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 10857605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C3D2139A for ; Mon, 18 Mar 2019 13:18:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 233EC286CB for ; Mon, 18 Mar 2019 13:18:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 178C028723; Mon, 18 Mar 2019 13:18:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF937286CB for ; Mon, 18 Mar 2019 13:18:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbfCRNSj (ORCPT ); Mon, 18 Mar 2019 09:18:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbfCRNSj (ORCPT ); Mon, 18 Mar 2019 09:18:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1647E3082E68 for ; Mon, 18 Mar 2019 13:18:39 +0000 (UTC) Received: from bfoster.bos.redhat.com (dhcp-41-2.bos.redhat.com [10.18.41.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7A1E60C4C for ; Mon, 18 Mar 2019 13:18:38 +0000 (UTC) From: Brian Foster 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 Message-Id: <20190318131838.19019-1-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 18 Mar 2019 13:18:39 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Darrick J. Wong --- 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);