diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2014-08-22 01:22:51 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-08-22 01:20:39 -0400 |
commit | 787aded65044e4cabefcf7eb7576c2dd6b151468 (patch) | |
tree | 43f16f4b5407733662fd975ca8156aef5e545fb4 /fs/cifs | |
parent | d4a029d21556437b09ffb3207cf2871651bec38f (diff) |
cifs: Allow directIO read/write during cache=strict
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@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/dir.c | 8 | ||||
-rw-r--r-- | fs/cifs/file.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3db0c5fd9a11..6cbd9c688cfe 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -497,6 +497,14 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | if (file->f_flags & O_DIRECT && | ||
501 | CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
502 | if (CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
503 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
504 | else | ||
505 | file->f_op = &cifs_file_direct_ops; | ||
506 | } | ||
507 | |||
500 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); | 508 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); |
501 | if (file_info == NULL) { | 509 | if (file_info == NULL) { |
502 | if (server->ops->close) | 510 | if (server->ops->close) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index d5fec92e0360..7c018a1c52f7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -467,6 +467,14 @@ int cifs_open(struct inode *inode, struct file *file) | |||
467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", | 467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", |
468 | inode, file->f_flags, full_path); | 468 | inode, file->f_flags, full_path); |
469 | 469 | ||
470 | if (file->f_flags & O_DIRECT && | ||
471 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
472 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
473 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
474 | else | ||
475 | file->f_op = &cifs_file_direct_ops; | ||
476 | } | ||
477 | |||
470 | if (server->oplocks) | 478 | if (server->oplocks) |
471 | oplock = REQ_OPLOCK; | 479 | oplock = REQ_OPLOCK; |
472 | else | 480 | else |