From patchwork Mon May 22 09:58:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Brandenburg X-Patchwork-Id: 9741381 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 6F5EA6034C for ; Mon, 22 May 2017 21:00:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62AA02875C for ; Mon, 22 May 2017 21:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 579C32875F; Mon, 22 May 2017 21:00:41 +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=-4.9 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 EC01E2875C for ; Mon, 22 May 2017 21:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762659AbdEVVAh (ORCPT ); Mon, 22 May 2017 17:00:37 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:35931 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762648AbdEVVA1 (ORCPT ); Mon, 22 May 2017 17:00:27 -0400 Received: by mail-qk0-f180.google.com with SMTP id u75so116544672qka.3 for ; Mon, 22 May 2017 14:00:21 -0700 (PDT) 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=04XmdPgIlClzn7oeZwubdx5ldXmKyUx1UqNf6foLRpg=; b=VmQWRqYdNR/YBJmJ22lNqEantwV2ZQWFrS9yHjAFfIIyxj+L4AQE7GiVKuxMTAdr69 DuT8s0m76roVcRJSAwvgMUrHzFgBfFcbHvOE1sJrTYZtfEroj3xwNLJ9AJwcjUppX8xf Ya89j/ikn2lr5xZ8DlePht8TMk+MxQ1rThyxiqTNOFBNRgTV7aPyJpZbO5oWgapFbFsI 0SsYRwPGVlHPv3lTs9aT5QceZDweoT3N/b8L3qOjrdGIwWmIr1kzd0QQ9EhFcXqix5Nz wy9rRGEQmVI3zHYSOEb0qWDXq9iYkGQvdiWVaAhP0Gy+kvUBMAydxqDsd6KU12HYck15 ecVA== 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=04XmdPgIlClzn7oeZwubdx5ldXmKyUx1UqNf6foLRpg=; b=XGqnnER+3W2/BnBGsvmtxlI52Jw3xKHCs7qkmh1JN0jENWHg9YYcmZI+rzJNHA8W+M /JopZ1aDDzOONfVMSXbx4tbLeb0Cu6CXh2AGilQY7I6+mI9vI+Lj3xgssJWSODuiUk6i DXgwPpamP6llyZNgbOHWG95FWTGBOL6aY7V4EZkvX5DcJ+MPPBK5e9HjeiSbV1N4jXis fTQy3bVyQfM9+3bUza+/Ms4mmFEsA2665WESGdjZbjqTB2Y5hQWfLce/KIrDAb4NDeTz U3JE3NBF0yBJN64zyAux6vqkKJVTMV/idB4lny1mHK0t4g7bG1HnZXBPkVvrmysN54jT lQAw== X-Gm-Message-State: AODbwcCFhbZTGRzouKjdVoj0Alm+NgCMsgTsao0BtiEinHUotBONi7zy /WO+/76Xrt/PpMYf3RVsQw== X-Received: by 10.55.203.72 with SMTP id d69mr22606067qkj.167.1495486821286; Mon, 22 May 2017 14:00:21 -0700 (PDT) Received: from mkbserver1.clemson.edu ([130.127.148.244]) by smtp.gmail.com with ESMTPSA id z203sm12740113qkb.46.2017.05.22.14.00.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 14:00:20 -0700 (PDT) From: Martin Brandenburg To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org Cc: Martin Brandenburg Subject: [PATCH 10/13] orangefs: implement direct_IO for the read case Date: Mon, 22 May 2017 05:58:58 -0400 Message-Id: <1495447141-12216-11-git-send-email-martin@omnibond.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1495447141-12216-1-git-send-email-martin@omnibond.com> References: <1495447141-12216-1-git-send-email-martin@omnibond.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 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 c3f44aa..cd126dd 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -819,22 +819,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 */