Re: [PATCH 2/7] cifs: Allow directIO read/write during cache=strict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Aug 2014 19:39:11 +0900
Namjae Jeon <namjae.jeon@xxxxxxxxxxx> wrote:

> 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@xxxxxxxxxxx>
> Signed-off-by: Ashish Sangwan <a.sangwan@xxxxxxxxxxx>
> ---
>  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

Looks fine for the most part. You should also avoid requesting an
oplock if you're going to open O_DIRECT since you won't be using it
anyway.

-- 
Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux