Message ID | 20171222120556.7435-19-jlayton@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 2017-12-22 at 07:05 -0500, Jeff Layton wrote: > From: Jeff Layton <jlayton@redhat.com> > > At this point, we know that "now" and the file times may differ, and we > suspect that the i_version has been flagged to be bumped. Attempt to > bump the i_version, and only mark the inode dirty if that actually > occurred or if one of the times was updated. > > Signed-off-by: Jeff Layton <jlayton@redhat.com> > --- > fs/btrfs/inode.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index ac8692849a81..76245323a7c8 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -6107,19 +6107,20 @@ static int btrfs_update_time(struct inode *inode, struct timespec *now, > int flags) > { > struct btrfs_root *root = BTRFS_I(inode)->root; > + bool dirty = flags & ~S_VERSION; > > if (btrfs_root_readonly(root)) > return -EROFS; > > if (flags & S_VERSION) > - inode_inc_iversion(inode); > + dirty |= inode_maybe_inc_iversion(inode, dirty); > if (flags & S_CTIME) > inode->i_ctime = *now; > if (flags & S_MTIME) > inode->i_mtime = *now; > if (flags & S_ATIME) > inode->i_atime = *now; > - return btrfs_dirty_inode(inode); > + return dirty ? btrfs_dirty_inode(inode) : 0; > } > > /* Hi btrfs folks! I posted this set just before xmas, and am hoping to send Linus a PR for it when the next merge window opens. Both the ext4 and xfs folks have acked their respective parts. I'll note that this set helps small I/O workloads on xfs and ext4 significantly, but somewhat less so on btrfs. I'd also appreciate any insight as to why it doesn't help on btrfs as much, and whether we can alter this approach to help things there. Many thanks!
On Wed, Jan 03, 2018 at 11:43:51AM -0500, Jeff Layton wrote: > I posted this set just before xmas, and am hoping to send Linus a PR for > it when the next merge window opens. Both the ext4 and xfs folks have > acked their respective parts. > > I'll note that this set helps small I/O workloads on xfs and ext4 > significantly, but somewhat less so on btrfs. I'd also appreciate any > insight as to why it doesn't help on btrfs as much, and whether we can > alter this approach to help things there. I don't have an idea why this does not help that much but I'm going to ack the patchse so you can push the patchset forward. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Dec 22, 2017 at 07:05:55AM -0500, Jeff Layton wrote: > From: Jeff Layton <jlayton@redhat.com> > > At this point, we know that "now" and the file times may differ, and we > suspect that the i_version has been flagged to be bumped. Attempt to > bump the i_version, and only mark the inode dirty if that actually > occurred or if one of the times was updated. > > Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: David Sterba <dsterba@suse.com> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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/btrfs/inode.c b/fs/btrfs/inode.c index ac8692849a81..76245323a7c8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6107,19 +6107,20 @@ static int btrfs_update_time(struct inode *inode, struct timespec *now, int flags) { struct btrfs_root *root = BTRFS_I(inode)->root; + bool dirty = flags & ~S_VERSION; if (btrfs_root_readonly(root)) return -EROFS; if (flags & S_VERSION) - inode_inc_iversion(inode); + dirty |= inode_maybe_inc_iversion(inode, dirty); if (flags & S_CTIME) inode->i_ctime = *now; if (flags & S_MTIME) inode->i_mtime = *now; if (flags & S_ATIME) inode->i_atime = *now; - return btrfs_dirty_inode(inode); + return dirty ? btrfs_dirty_inode(inode) : 0; } /*