[PATCH v4 9/9] btrfs: convert to multigrain timestamps

Jeff Layton posted 9 patches 2 years, 8 months ago
There is a newer version of this series
[PATCH v4 9/9] btrfs: convert to multigrain timestamps
Posted by Jeff Layton 2 years, 8 months ago
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/btrfs/delayed-inode.c | 2 +-
 fs/btrfs/inode.c         | 2 +-
 fs/btrfs/super.c         | 5 +++--
 fs/btrfs/tree-log.c      | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 6b457b010cbc..8307fd69da43 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1810,7 +1810,7 @@ static void fill_stack_inode_item(struct btrfs_trans_handle *trans,
 	btrfs_set_stack_timespec_sec(&inode_item->ctime,
 				     inode->i_ctime.tv_sec);
 	btrfs_set_stack_timespec_nsec(&inode_item->ctime,
-				      inode->i_ctime.tv_nsec);
+				      ctime_nsec_peek(inode));
 
 	btrfs_set_stack_timespec_sec(&inode_item->otime,
 				     BTRFS_I(inode)->i_otime.tv_sec);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2335b5e1cecc..b27d4dda6024 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3970,7 +3970,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
 	btrfs_set_token_timespec_sec(&token, &item->ctime,
 				     inode->i_ctime.tv_sec);
 	btrfs_set_token_timespec_nsec(&token, &item->ctime,
-				      inode->i_ctime.tv_nsec);
+				      ctime_nsec_peek(inode));
 
 	btrfs_set_token_timespec_sec(&token, &item->otime,
 				     BTRFS_I(inode)->i_otime.tv_sec);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index ec18e2210602..fc6abf8b1f42 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2144,7 +2144,7 @@ static struct file_system_type btrfs_fs_type = {
 	.name		= "btrfs",
 	.mount		= btrfs_mount,
 	.kill_sb	= btrfs_kill_super,
-	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
+	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MULTIGRAIN_TS,
 };
 
 static struct file_system_type btrfs_root_fs_type = {
@@ -2152,7 +2152,8 @@ static struct file_system_type btrfs_root_fs_type = {
 	.name		= "btrfs",
 	.mount		= btrfs_mount_root,
 	.kill_sb	= btrfs_kill_super,
-	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
+	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
+			  FS_ALLOW_IDMAP | FS_MULTIGRAIN_TS,
 };
 
 MODULE_ALIAS_FS("btrfs");
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 9b212e8c70cc..9a4d1b2ab204 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4150,7 +4150,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
 	btrfs_set_token_timespec_sec(&token, &item->ctime,
 				     inode->i_ctime.tv_sec);
 	btrfs_set_token_timespec_nsec(&token, &item->ctime,
-				      inode->i_ctime.tv_nsec);
+				      ctime_nsec_peek(inode));
 
 	/*
 	 * We do not need to set the nbytes field, in fact during a fast fsync
-- 
2.40.1
Re: [PATCH v4 9/9] btrfs: convert to multigrain timestamps
Posted by David Sterba 2 years, 8 months ago
On Thu, May 18, 2023 at 07:47:42AM -0400, Jeff Layton wrote:
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Acked-by: David Sterba <dsterba@suse.com>

Please add a brief description to the changelog too, there's a similar
text in the patches adding the infrastructure. Something like "Allow to
optimize lot of metadata updates by encoding the status in the cmtime.
The fine grained time is needed for NFS."
Re: [PATCH v4 9/9] btrfs: convert to multigrain timestamps
Posted by Jeff Layton 2 years, 8 months ago
On Mon, 2023-05-22 at 11:56 +0200, David Sterba wrote:
> On Thu, May 18, 2023 at 07:47:42AM -0400, Jeff Layton wrote:
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> 
> Acked-by: David Sterba <dsterba@suse.com>
> 
> Please add a brief description to the changelog too, there's a similar
> text in the patches adding the infrastructure. Something like "Allow to
> optimize lot of metadata updates by encoding the status in the cmtime.
> The fine grained time is needed for NFS."

Sure thing.

Christian, do you want to just alter the changelog with David's
suggestion, or would you rather I resend the series?

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>
Re: [PATCH v4 9/9] btrfs: convert to multigrain timestamps
Posted by Christian Brauner 2 years, 8 months ago
On Mon, May 22, 2023 at 06:08:56AM -0400, Jeff Layton wrote:
> On Mon, 2023-05-22 at 11:56 +0200, David Sterba wrote:
> > On Thu, May 18, 2023 at 07:47:42AM -0400, Jeff Layton wrote:
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > 
> > Acked-by: David Sterba <dsterba@suse.com>
> > 
> > Please add a brief description to the changelog too, there's a similar
> > text in the patches adding the infrastructure. Something like "Allow to
> > optimize lot of metadata updates by encoding the status in the cmtime.
> > The fine grained time is needed for NFS."
> 
> Sure thing.
> 
> Christian, do you want to just alter the changelog with David's
> suggestion, or would you rather I resend the series?

Nah, don't bother resending I'll just add it to the fs specific patches.
I'll end up updating the patch trailers anyway when individual
maintainers add new Acks.