From patchwork Tue Jun 20 12:05:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9799335 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 764FE601BC for ; Tue, 20 Jun 2017 12:06:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 684E1201BC for ; Tue, 20 Jun 2017 12:06:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D31C205A4; Tue, 20 Jun 2017 12:06:09 +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 D8A64201BC for ; Tue, 20 Jun 2017 12:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751120AbdFTMGI (ORCPT ); Tue, 20 Jun 2017 08:06:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:57391 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751056AbdFTMGI (ORCPT ); Tue, 20 Jun 2017 08:06:08 -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 mx1.suse.de (Postfix) with ESMTP id 9E8B1ABC8; Tue, 20 Jun 2017 12:06:06 +0000 (UTC) From: Goldwyn Rodrigues To: axboe@kernel.dk Cc: viro@ZenIV.linux.org.uk, hch@lst.de, jack@suse.cz, akpm@linux-foundation.org, linux-block@vger.kernel.org, Goldwyn Rodrigues Subject: [PATCH 06/10] fs: Introduce IOMAP_NOWAIT Date: Tue, 20 Jun 2017 07:05:45 -0500 Message-Id: <20170620120549.23147-7-rgoldwyn@suse.de> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170620120549.23147-1-rgoldwyn@suse.de> References: <20170620120549.23147-1-rgoldwyn@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Goldwyn Rodrigues IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Signed-off-by: Goldwyn Rodrigues --- fs/iomap.c | 8 ++++++++ include/linux/iomap.h | 1 + 2 files changed, 9 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index 18f2f2b8ba2c..c71a64b97fba 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -881,6 +881,14 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, flags |= IOMAP_WRITE; } + if (iocb->ki_flags & IOCB_NOWAIT) { + if (filemap_range_has_page(mapping, start, end)) { + ret = -EAGAIN; + goto out_free_dio; + } + flags |= IOMAP_NOWAIT; + } + ret = filemap_write_and_wait_range(mapping, start, end); if (ret) goto out_free_dio; diff --git a/include/linux/iomap.h b/include/linux/iomap.h index f753e788da31..69f4e9470084 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -52,6 +52,7 @@ struct iomap { #define IOMAP_REPORT (1 << 2) /* report extent status, e.g. FIEMAP */ #define IOMAP_FAULT (1 << 3) /* mapping for page fault */ #define IOMAP_DIRECT (1 << 4) /* direct I/O */ +#define IOMAP_NOWAIT (1 << 5) /* Don't wait for writeback */ struct iomap_ops { /*