From patchwork Tue Oct 10 10:58:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9995811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2F09603B5 for ; Tue, 10 Oct 2017 10:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A907128505 for ; Tue, 10 Oct 2017 10:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DEF728508; Tue, 10 Oct 2017 10:58:16 +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=-6.9 required=2.0 tests=BAYES_00,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 2AA2428505 for ; Tue, 10 Oct 2017 10:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932153AbdJJK6O (ORCPT ); Tue, 10 Oct 2017 06:58:14 -0400 Received: from mx2.suse.de ([195.135.220.15]:39068 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932152AbdJJK6L (ORCPT ); Tue, 10 Oct 2017 06:58:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D3B4FACC1; Tue, 10 Oct 2017 10:58:09 +0000 (UTC) From: Goldwyn Rodrigues To: linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com, david@fromorbit.com, bfoster@redhat.com, Goldwyn Rodrigues Subject: [PATCH v3 2/3] xfs_io: Add RWF_NOWAIT to pwritev2() Date: Tue, 10 Oct 2017 05:58:01 -0500 Message-Id: <20171010105802.31353-2-rgoldwyn@suse.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171010105802.31353-1-rgoldwyn@suse.de> References: <20171010105802.31353-1-rgoldwyn@suse.de> 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 From: Goldwyn Rodrigues This allows to make pwritev2() calls with RWF_NOWAIT, which would fail in case the call blocks. Signed-off-by: Goldwyn Rodrigues Changes since v2: - ifdef around -N which set RWF_NOWAIT Reviewed-by: Brian Foster --- io/pwrite.c | 10 +++++++++- man/man8/xfs_io.8 | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/io/pwrite.c b/io/pwrite.c index 5ceb26c7..e06dfb46 100644 --- a/io/pwrite.c +++ b/io/pwrite.c @@ -53,6 +53,9 @@ pwrite_help(void) #ifdef HAVE_PWRITEV " -V N -- use vectored IO with N iovecs of blocksize each (pwritev)\n" #endif +#ifdef HAVE_PWRITEV2 +" -N -- Perform the pwritev2() with RWF_NOWAIT\n" +#endif "\n")); } @@ -279,7 +282,7 @@ pwrite_f( init_cvtnum(&fsblocksize, &fssectsize); bsize = fsblocksize; - while ((c = getopt(argc, argv, "b:BCdf:Fi:qRs:S:uV:wWZ:")) != EOF) { + while ((c = getopt(argc, argv, "b:BCdf:Fi:NqRs:S:uV:wWZ:")) != EOF) { switch (c) { case 'b': tmp = cvtnum(fsblocksize, fssectsize, optarg); @@ -308,6 +311,11 @@ pwrite_f( case 'i': infile = optarg; break; +#ifdef HAVE_PWRITEV2 + case 'N': + pwritev2_flags |= RWF_NOWAIT; + break; +#endif case 's': skip = cvtnum(fsblocksize, fssectsize, optarg); if (skip < 0) { diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8 index 0fd9b951..9c58914f 100644 --- a/man/man8/xfs_io.8 +++ b/man/man8/xfs_io.8 @@ -282,6 +282,12 @@ Use the vectored IO write syscall with a number of blocksize length iovecs. The number of iovecs is set by the .I vectors parameter. +.TP +.B \-N +Perform the +.BR pwritev2 (2) +call with +.I RWF_NOWAIT. .RE .PD .TP