Message ID | 1520772074-202412-1-git-send-email-cgxu519@gmx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Mar 11, 2018 at 8:41 PM, Chengguang Xu <cgxu519@gmx.com> 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@gmx.com> > --- > 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@vger.kernel.org > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Sent: Monday, March 12, 2018 at 3:07 PM > From: "Yan, Zheng" <ukernel@gmail.com> > To: "Chengguang Xu" <cgxu519@gmx.com> > Cc: "Zheng Yan" <zyan@redhat.com>, "Ilya Dryomov" <idryomov@gmail.com>, ceph-devel <ceph-devel@vger.kernel.org> > Subject: Re: [PATCH v2] ceph: sync metadata when having I_DIRTY_DATASYNC flag in fdatasync > > On Sun, Mar 11, 2018 at 8:41 PM, Chengguang Xu <cgxu519@gmx.com> 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@gmx.com> > > --- > > 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 How about change nothing in the ceph_fsync() and delete the code which never be executed in __ceph_mark_dirty_caps()? Thanks, Chengguang. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" 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/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; inode_lock(inode);
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@gmx.com> --- Changes since v1: - if inode is clean then skip metadata sync. fs/ceph/caps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)