Message ID | 1449067568-23038-1-git-send-email-ross.lagerwall@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
merged into cifs-2.6.git On Wed, Dec 2, 2015 at 8:46 AM, Ross Lagerwall <ross.lagerwall@citrix.com> wrote: > Currently O_DIRECT is supported with cache=none and cache=strict, but > not cache=loose. Add support for using O_DIRECT when mounted with > cache=loose. > > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> > --- > fs/cifs/cifsfs.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c > index cbc0f4b..e6e7013 100644 > --- a/fs/cifs/cifsfs.c > +++ b/fs/cifs/cifsfs.c > @@ -752,6 +752,9 @@ cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) > ssize_t rc; > struct inode *inode = file_inode(iocb->ki_filp); > > + if (iocb->ki_filp->f_flags & O_DIRECT) > + return cifs_user_readv(iocb, iter); > + > rc = cifs_revalidate_mapping(inode); > if (rc) > return rc; > @@ -766,6 +769,18 @@ static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) > ssize_t written; > int rc; > > + if (iocb->ki_filp->f_flags & O_DIRECT) { > + written = cifs_user_writev(iocb, from); > + if (written > 0 && CIFS_CACHE_READ(cinode)) { > + cifs_zap_mapping(inode); > + cifs_dbg(FYI, > + "Set no oplock for inode=%p after a write operation\n", > + inode); > + cinode->oplock = 0; > + } > + return written; > + } > + > written = cifs_get_writer(cinode); > if (written) > return written; > -- > 2.4.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index cbc0f4b..e6e7013 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -752,6 +752,9 @@ cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) ssize_t rc; struct inode *inode = file_inode(iocb->ki_filp); + if (iocb->ki_filp->f_flags & O_DIRECT) + return cifs_user_readv(iocb, iter); + rc = cifs_revalidate_mapping(inode); if (rc) return rc; @@ -766,6 +769,18 @@ static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) ssize_t written; int rc; + if (iocb->ki_filp->f_flags & O_DIRECT) { + written = cifs_user_writev(iocb, from); + if (written > 0 && CIFS_CACHE_READ(cinode)) { + cifs_zap_mapping(inode); + cifs_dbg(FYI, + "Set no oplock for inode=%p after a write operation\n", + inode); + cinode->oplock = 0; + } + return written; + } + written = cifs_get_writer(cinode); if (written) return written;
Currently O_DIRECT is supported with cache=none and cache=strict, but not cache=loose. Add support for using O_DIRECT when mounted with cache=loose. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> --- fs/cifs/cifsfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)