Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 2/7] cifs: Allow directIO read/write during cache=strict
@ 2014-08-20 10:39 Namjae Jeon
  2014-08-21  4:52 ` Steve French
  2014-08-21 11:26 ` Jeff Layton
  0 siblings, 2 replies; 8+ messages in thread
From: Namjae Jeon @ 2014-08-20 10:39 UTC (permalink / raw)
  To: 'Steve French'
  Cc: 'Shirish Pargaonkar', 'Pavel Shilovsky',
	linux-cifs-u79uwXL29TY76Z2rM5mHXA, Ashish Sangwan

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 <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Ashish Sangwan <a.sangwan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 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
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-21 15:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 10:39 [PATCH 2/7] cifs: Allow directIO read/write during cache=strict Namjae Jeon
2014-08-21  4:52 ` Steve French
     [not found]   ` <CAH2r5mvn86=76_O7QT0WMftjnr3Ek4t5PiqcWCy1HpaKVO=GFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-21 10:07     ` Namjae Jeon
2014-08-21 11:26 ` Jeff Layton
     [not found]   ` <20140821072656.372e613c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2014-08-21 13:24     ` Steve French
     [not found]       ` <CAH2r5mu6LH1YLqWhi4-1dgJH0BQ2CS5Lbym1mGP9EuvgtCP1Wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-21 15:02         ` Jeff Layton
     [not found]           ` <20140821110254.4f2dcc95-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2014-08-21 15:18             ` Steve French
     [not found]               ` <CAH2r5mvAhxXXzG-Rgt2BD4a8EYsdGRcfUeEZC=AF5XTNO6ZXeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-21 15:56                 ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox