From patchwork Tue Dec 12 18:34:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Brandenburg X-Patchwork-Id: 10108077 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 85FB8602B3 for ; Tue, 12 Dec 2017 18:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C062285A4 for ; Tue, 12 Dec 2017 18:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 701C9297B8; Tue, 12 Dec 2017 18:35:49 +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,DKIM_SIGNED, DKIM_VALID,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 14884285A4 for ; Tue, 12 Dec 2017 18:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbdLLSfH (ORCPT ); Tue, 12 Dec 2017 13:35:07 -0500 Received: from mail-yb0-f193.google.com ([209.85.213.193]:37802 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577AbdLLSfC (ORCPT ); Tue, 12 Dec 2017 13:35:02 -0500 Received: by mail-yb0-f193.google.com with SMTP id 5so9213479ybp.4 for ; Tue, 12 Dec 2017 10:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omnibond-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/q1LdYFhBqBEvAgWYoweUlXyup+S0AnLt38C1sydPb4=; b=JOcZfi6qQtvlB/4qyfnXL0wG8XJBJeF6OGk0LYG5OTYIVlUep1AAAn3uOlvk8aJmnb JxeP3PEEGNGgk13SfNZwrxbiKZ194PX+m6x/8OFkookjAKoYNmdbubnNwBRqkQ6RUGYV Esd/YsHET+IuUzFE7Dt8J3q2Mpy5pKelzhVgKRwJ5qrv0Jh6U4GXwreMtJz83xhH5dQR s60C9w4OJXfNd4cltRqNiqH7tn47QUw8GTb7oKP+3RALR1Ro49QAFd93/SVpaTR4Nbyl R3QEhO3c2Lh1zR8Ir8Ulh7szOzsf9uEQrMiv4MdbqwtvD1uvEn8bo0oS46lyEG6gv5yg evkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/q1LdYFhBqBEvAgWYoweUlXyup+S0AnLt38C1sydPb4=; b=QhTXhI+iCEARB/nM96NViSNFu+xGrxk/Xx+DgW1CCoi2fo/7/76cDkk8VaXE6rhEgF Djlip9PkiulfeaLI2lSEz8C3Nran9OIduGHk5hCmA8r2E/dWORASkLtW3E1RMfAiAuot tbJNtMdzaYraXaqjxCjGugpeaP/N6heCK7YF8gT9BswPgcqn2bnLpWpzuYpdOkAg/ySf izAw742pq56MkQpZc/4dzkEhb70X4b5x6A9Ugzf5YSxFG9PJFVkJgFBr2SgRyj0wp26T iJRlcZIdPEYZkOl3Hu1O1vvGUCfKkBFqDkWgXfV0LkKKvhDPdWXcuZkxxN/68ti9Akra BCRA== X-Gm-Message-State: AKGB3mJ6PIVVYyaLMNxT4rUZWJ6eu1cKLfE5b4u6dvRxU0LYPhyN87bJ GY0Af5Iz7DNF90fWgZCWol0rCQ== X-Google-Smtp-Source: ACJfBov9KbQ2DUWutD84xegjlxrp2bqNbTlFxZHECovUrvlfqyen3wwXrX9ShltU7Zpb5Y4wgH32Mg== X-Received: by 10.37.207.150 with SMTP id f144mr3881387ybg.408.1513103701772; Tue, 12 Dec 2017 10:35:01 -0800 (PST) Received: from omnifs1.omnibond.com ([24.31.12.185]) by smtp.gmail.com with ESMTPSA id i207sm7666353ywe.38.2017.12.12.10.34.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2017 10:35:00 -0800 (PST) From: Martin Brandenburg X-Google-Original-From: Martin Brandenburg To: hubcap@omnibond.com, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Martin Brandenburg Subject: [PATCH 14/18] orangefs: implement direct_IO for the read case Date: Tue, 12 Dec 2017 13:34:20 -0500 Message-Id: <20171212183424.26406-15-martin@martinbrandenburg.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171212183424.26406-1-martin@martinbrandenburg.com> References: <20171212183424.26406-1-martin@martinbrandenburg.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Brandenburg Since orangefs_file_read_iter now calls generic_file_read_iter, O_DIRECT now goes through direct_IO in the read case. In the write case, orangefs_file_write_iter never calls direct_IO, but handles the direct write manually. Signed-off-by: Martin Brandenburg --- fs/orangefs/file.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 1c30e9abb8cb..0223a0351d11 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -787,22 +787,17 @@ static int orangefs_releasepage(struct page *page, gfp_t foo) return 0; } -/* - * Having a direct_IO entry point in the address_space_operations - * struct causes the kernel to allows us to use O_DIRECT on - * open. Nothing will ever call this thing, but in the future we - * will need to be able to use O_DIRECT on open in order to support - * AIO. Modeled after NFS, they do this too. - */ - static ssize_t orangefs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) { - gossip_debug(GOSSIP_INODE_DEBUG, - "orangefs_direct_IO: %pD\n", - iocb->ki_filp); - - return -EINVAL; + struct file *file = iocb->ki_filp; + loff_t pos = *(&iocb->ki_pos); + /* + * This cannot happen until write_iter becomes + * generic_file_write_iter. + */ + BUG_ON(iov_iter_rw(iter) != READ); + return do_readv_writev(ORANGEFS_IO_READ, file, &pos, iter); } /** ORANGEFS2 implementation of address space operations */