diff options
author | Sage Weil <sage@newdream.net> | 2011-07-26 14:26:07 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-07-26 14:26:07 -0400 |
commit | 4918b6d140c4822201ebbe2f070875332aff337b (patch) | |
tree | 0327a0a68acd2f8209893b4770ba3c9d9264041c /fs/ceph/file.c | |
parent | 252c6728de604d6a897d85e212996811d5c8c46c (diff) |
ceph: add F_SYNC file flag to force sync (non-O_DIRECT) io
This allows us to force IO through the sync path which you normally only
get when multiple clients are reading/writing to the same file or by
mounting with -o sync. Among other things, this lets test programs verify
correctness with a single mount.
Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 4698a5c553dc..44e4fe9fba02 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -643,7 +643,8 @@ again: | |||
643 | 643 | ||
644 | if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || | 644 | if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || |
645 | (iocb->ki_filp->f_flags & O_DIRECT) || | 645 | (iocb->ki_filp->f_flags & O_DIRECT) || |
646 | (inode->i_sb->s_flags & MS_SYNCHRONOUS)) | 646 | (inode->i_sb->s_flags & MS_SYNCHRONOUS) || |
647 | (fi->flags & CEPH_F_SYNC)) | ||
647 | /* hmm, this isn't really async... */ | 648 | /* hmm, this isn't really async... */ |
648 | ret = ceph_sync_read(filp, base, len, ppos, &checkeof); | 649 | ret = ceph_sync_read(filp, base, len, ppos, &checkeof); |
649 | else | 650 | else |
@@ -720,7 +721,8 @@ retry_snap: | |||
720 | 721 | ||
721 | if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 || | 722 | if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 || |
722 | (iocb->ki_filp->f_flags & O_DIRECT) || | 723 | (iocb->ki_filp->f_flags & O_DIRECT) || |
723 | (inode->i_sb->s_flags & MS_SYNCHRONOUS)) { | 724 | (inode->i_sb->s_flags & MS_SYNCHRONOUS) || |
725 | (fi->flags & CEPH_F_SYNC)) { | ||
724 | ret = ceph_sync_write(file, iov->iov_base, iov->iov_len, | 726 | ret = ceph_sync_write(file, iov->iov_base, iov->iov_len, |
725 | &iocb->ki_pos); | 727 | &iocb->ki_pos); |
726 | } else { | 728 | } else { |