From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B20A8C0044C for ; Wed, 31 Oct 2018 22:14:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7533420664 for ; Wed, 31 Oct 2018 22:14:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7533420664 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbeKAHOg (ORCPT ); Thu, 1 Nov 2018 03:14:36 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:46978 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725755AbeKAHOf (ORCPT ); Thu, 1 Nov 2018 03:14:35 -0400 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with ESMTP id Hyk2g4ZDjbOGjHyk2gzy2j; Wed, 31 Oct 2018 15:13:34 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.91) (envelope-from ) id 1gHyk1-0000gk-VS; Wed, 31 Oct 2018 15:13:34 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [Patch v4 3/3] CIFS: Add direct I/O functions to file_operations Date: Wed, 31 Oct 2018 22:13:11 +0000 Message-Id: <20181031221311.2596-3-longli@linuxonhyperv.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181031221311.2596-1-longli@linuxonhyperv.com> References: <20181031221311.2596-1-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-CMAE-Envelope: MS4wfGEI+e0OWB/Cv8nU4vELvGFJ0VfqsDNujUeSkcNDOBjrLEpJQPs6PPQIYRmdIWBmrhOe/cQ7BU7OXLSrwTRidz+0T9IIKxL3r7QEwOp2tAZ4ZbXkcMNl A+33LDBTREt0vZzB5TPQ2z+3rMqbKzItg4LrgZrO7WJ756IcomaWIXD8034SRmAwZ6EpFB0P0Zt09cGf2JRqGszeMinTZKHGgIshmP0FzDTlz78s5eP3BqrQ 5fe/1hxvqyNtt4pPwTPOgBkekb6K8MZ9DjZCKUYFYboF7vvWTBNQ+DkVI7y70zEXxs98X8ByThRu5u6CKtioWOEZa6QUtxYmfDcBj5x9ePFwER6VgPnO6gL4 /VObBeSZraG2/cDVBvzE/n1Lynigsw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Long Li With direct read/write functions implemented, add them to file_operations. Dircet I/O is used under two conditions: 1. When mounting with "cache=none", CIFS uses direct I/O for all user file data transfer. 2. When opening a file with O_DIRECT, CIFS uses direct I/O for all data transfer on this file. Signed-off-by: Long Li --- fs/cifs/cifsfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 62f1662..f18091b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1113,9 +1113,8 @@ const struct file_operations cifs_file_strict_ops = { }; const struct file_operations cifs_file_direct_ops = { - /* BB reevaluate whether they can be done with directio, no cache */ - .read_iter = cifs_user_readv, - .write_iter = cifs_user_writev, + .read_iter = cifs_direct_readv, + .write_iter = cifs_direct_writev, .open = cifs_open, .release = cifs_close, .lock = cifs_lock, @@ -1169,9 +1168,8 @@ const struct file_operations cifs_file_strict_nobrl_ops = { }; const struct file_operations cifs_file_direct_nobrl_ops = { - /* BB reevaluate whether they can be done with directio, no cache */ - .read_iter = cifs_user_readv, - .write_iter = cifs_user_writev, + .read_iter = cifs_direct_readv, + .write_iter = cifs_direct_writev, .open = cifs_open, .release = cifs_close, .fsync = cifs_fsync, -- 2.7.4