From patchwork Wed Aug 20 10:39:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 4748881 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 58EEF9F375 for ; Wed, 20 Aug 2014 10:39:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BFF120155 for ; Wed, 20 Aug 2014 10:39:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DAA32014A for ; Wed, 20 Aug 2014 10:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752264AbaHTKjO (ORCPT ); Wed, 20 Aug 2014 06:39:14 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:18165 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752258AbaHTKjN (ORCPT ); Wed, 20 Aug 2014 06:39:13 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NAL003RSPLBK230@mailout2.samsung.com> for linux-cifs@vger.kernel.org; Wed, 20 Aug 2014 19:39:11 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.116]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id F4.55.13863.FCA74F35; Wed, 20 Aug 2014 19:39:11 +0900 (KST) X-AuditID: cbfee690-b7f526d000003627-b9-53f47acf3581 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EE.ED.05196.FCA74F35; Wed, 20 Aug 2014 19:39:11 +0900 (KST) Received: from DONAMJAEJEO06 ([10.88.104.63]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NAL00HE0PLBKGB0@mmp1.samsung.com>; Wed, 20 Aug 2014 19:39:11 +0900 (KST) From: Namjae Jeon To: 'Steve French' Cc: 'Shirish Pargaonkar' , 'Pavel Shilovsky' , linux-cifs@vger.kernel.org, Ashish Sangwan Subject: [PATCH 2/7] cifs: Allow directIO read/write during cache=strict Date: Wed, 20 Aug 2014 19:39:11 +0900 Message-id: <003501cfbc62$fac9f4b0$f05dde10$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac+8Yqb7pXetO9gjSqOZkPg/Zo7b3Q== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWyRsSkRPd81Zdgg6P7TS2WTrzEbPHi/y5m i3N7WS1ezGlgtHjz4jCbA6vHzll32T3m7upj9OjbsorR4/MmuQCWKC6blNSczLLUIn27BK6M cyuUCp5xV9yf84mpgfEyZxcjJ4eEgInEoekX2SBsMYkL99aD2UICSxklbjy3hKlZun0DSxcj F1B8EaPEpG0NbBDOX0aJY9caGLsYOTjYBLQl/mwRBWkQEVCX+Lz8LzOIzSywglHi0S8TEFtY wEPi0eN3jCA2i4CqxJp9t5lAbF4BS4m/P35A2YISPybfY4Ho1ZJYv/M4E4QtL7F5zVtmiIMU JHacfc0IsUtPYuPLfWwQNSIS+16AzOcCqtnELjFn5RVmiGUCEt8mH2IBuVNCQFZi0wGoOZIS B1fcYJnAKDYLyepZSFbPQrJ6FpIVCxhZVjGKphYkFxQnpReZ6BUn5haX5qXrJefnbmIExtrp f88m7GC8d8D6EGMy0PqJzFKiyfnAWM0riTc0NjOyMDUxNTYytzQ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/cdVK0v89GiLH6lte81f0GF1sU/7w/ktkjfKf839Oe/Aq/dUos xRmJhlrMRcWJAPF7geL7AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently cifs have all or nothing approach for directIO operations. cache=strict mode does not allow directIO while cache=none mode performs all the operations as directIO even when user does not specify O_DIRECT flag. This patch enables strict cache mode to honour directIO semantics. Signed-off-by: Namjae Jeon Signed-off-by: Ashish Sangwan --- fs/cifs/dir.c | 4 ++++ fs/cifs/file.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3db0c5f..30e377c 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -497,6 +497,10 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, goto out; } + if (file->f_flags & O_DIRECT && + CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) + file->f_op = &cifs_file_direct_ops; + file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); if (file_info == NULL) { if (server->ops->close) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index bee733e..0d07740 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -467,6 +467,10 @@ int cifs_open(struct inode *inode, struct file *file) cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", inode, file->f_flags, full_path); + if (file->f_flags & O_DIRECT && + cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) + file->f_op = &cifs_file_direct_ops; + if (server->oplocks) oplock = REQ_OPLOCK; else