Message ID | 1459273054-13478-10-git-send-email-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mar 29, 2016, at 11:37 AM, Christoph Hellwig <hch@lst.de> wrote: > > This is the per-I/O equivalent of O_DSYNC and O_SYNC, and very useful for > all kinds of file servers and storage targets. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/read_write.c | 6 +++++- > include/uapi/linux/fs.h | 2 ++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/fs/read_write.c b/fs/read_write.c > index cf377cf..3729d8d 100644 > --- a/fs/read_write.c > +++ b/fs/read_write.c > @@ -698,12 +698,16 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, > struct kiocb kiocb; > ssize_t ret; > > - if (flags & ~RWF_HIPRI) > + if (flags & ~(RWF_HIPRI | RWF_DSYNC | RWF_SYNC)) > return -EOPNOTSUPP; > > init_sync_kiocb(&kiocb, filp); > if (flags & RWF_HIPRI) > kiocb.ki_flags |= IOCB_HIPRI; > + if (flags & RWF_DSYNC) > + kiocb.ki_flags |= IOCB_DSYNC; > + if (flags & RWF_SYNC) > + kiocb.ki_flags |= (IOCB_DSYNC | IOCB_SYNC); > kiocb.ki_pos = *ppos; > > ret = fn(&kiocb, iter); > diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h > index a079d50..7f067fe 100644 > --- a/include/uapi/linux/fs.h > +++ b/include/uapi/linux/fs.h > @@ -324,5 +324,7 @@ struct fscrypt_policy { > > /* flags for preadv2/pwritev2: */ > #define RWF_HIPRI 0x00000001 /* high priority request, poll if possible */ > +#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC */ > +#define RWF_SYNC 0x00000002 /* per-IO O_SYNC */ Is it right that both of these flags are defined as "2"? From the code they look like they should be different values. Cheers, Andreas
On Tue, Mar 29, 2016 at 01:34:50PM -0600, Andreas Dilger wrote: > Is it right that both of these flags are defined as "2"? From the code > they look like they should be different values. Yes, they should. I did the same trick as we do for __O_SYNC earlier but then changed it last minute. I'll fix it up for the next version. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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/read_write.c b/fs/read_write.c index cf377cf..3729d8d 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -698,12 +698,16 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, struct kiocb kiocb; ssize_t ret; - if (flags & ~RWF_HIPRI) + if (flags & ~(RWF_HIPRI | RWF_DSYNC | RWF_SYNC)) return -EOPNOTSUPP; init_sync_kiocb(&kiocb, filp); if (flags & RWF_HIPRI) kiocb.ki_flags |= IOCB_HIPRI; + if (flags & RWF_DSYNC) + kiocb.ki_flags |= IOCB_DSYNC; + if (flags & RWF_SYNC) + kiocb.ki_flags |= (IOCB_DSYNC | IOCB_SYNC); kiocb.ki_pos = *ppos; ret = fn(&kiocb, iter); diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index a079d50..7f067fe 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -324,5 +324,7 @@ struct fscrypt_policy { /* flags for preadv2/pwritev2: */ #define RWF_HIPRI 0x00000001 /* high priority request, poll if possible */ +#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC */ +#define RWF_SYNC 0x00000002 /* per-IO O_SYNC */ #endif /* _UAPI_LINUX_FS_H */
This is the per-I/O equivalent of O_DSYNC and O_SYNC, and very useful for all kinds of file servers and storage targets. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/read_write.c | 6 +++++- include/uapi/linux/fs.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)