On Sun, Mar 11, 2018 at 8:41 PM, Chengguang Xu <cgxu519@xxxxxxx> wrote: > Add more condition checks for syncing metadata in fsync/fdatasync. > 1) if inode is clean then skip metadata sync. > 2) if inode is marked I_DIRTY_DATASYNC flag, then should sync metadata > even in fdatasync. > > Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx> > --- > Changes since v1: > - if inode is clean then skip metadata sync. > > fs/ceph/caps.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index 0e5bd3e..d5e4e49 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -2170,7 +2170,10 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync) > if (ret < 0) > goto out; > > - if (datasync) > + if (!(inode->i_state & I_DIRTY_ALL)) > + goto out; > + > + if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) > goto out; fsync also waits unsafe mds request. we don't mark inode dirty for unsafe request > > inode_lock(inode); > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html