Revert "btrfs: convert to multigrain timestamps"

This reverts commit 50e9ceef1d.

Users reported regressions due to enabling multi-grained timestamps
unconditionally. As no clear consensus on a solution has come up and the
discussion has gone back to the drawing board revert the infrastructure
changes for. If it isn't code that's here to stay, make it go away.

Message-ID: <20230920-keine-eile-c9755b5825db@brauner>
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2023-09-20 16:41:47 +02:00
parent 50ec1d721e
commit efd34f0316
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
2 changed files with 22 additions and 7 deletions

View File

@ -1106,6 +1106,25 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode)
btrfs_drew_write_unlock(&inode->root->snapshot_lock); btrfs_drew_write_unlock(&inode->root->snapshot_lock);
} }
static void update_time_for_write(struct inode *inode)
{
struct timespec64 now, ctime;
if (IS_NOCMTIME(inode))
return;
now = current_time(inode);
if (!timespec64_equal(&inode->i_mtime, &now))
inode->i_mtime = now;
ctime = inode_get_ctime(inode);
if (!timespec64_equal(&ctime, &now))
inode_set_ctime_to_ts(inode, now);
if (IS_I_VERSION(inode))
inode_inc_iversion(inode);
}
static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
size_t count) size_t count)
{ {
@ -1137,10 +1156,7 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
* need to start yet another transaction to update the inode as we will * need to start yet another transaction to update the inode as we will
* update the inode when we finish writing whatever data we write. * update the inode when we finish writing whatever data we write.
*/ */
if (!IS_NOCMTIME(inode)) { update_time_for_write(inode);
inode->i_mtime = inode_set_ctime_current(inode);
inode_inc_iversion(inode);
}
start_pos = round_down(pos, fs_info->sectorsize); start_pos = round_down(pos, fs_info->sectorsize);
oldsize = i_size_read(inode); oldsize = i_size_read(inode);

View File

@ -2150,7 +2150,7 @@ static struct file_system_type btrfs_fs_type = {
.name = "btrfs", .name = "btrfs",
.mount = btrfs_mount, .mount = btrfs_mount,
.kill_sb = btrfs_kill_super, .kill_sb = btrfs_kill_super,
.fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME, .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
}; };
static struct file_system_type btrfs_root_fs_type = { static struct file_system_type btrfs_root_fs_type = {
@ -2158,8 +2158,7 @@ static struct file_system_type btrfs_root_fs_type = {
.name = "btrfs", .name = "btrfs",
.mount = btrfs_mount_root, .mount = btrfs_mount_root,
.kill_sb = btrfs_kill_super, .kill_sb = btrfs_kill_super,
.fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
FS_ALLOW_IDMAP | FS_MGTIME,
}; };
MODULE_ALIAS_FS("btrfs"); MODULE_ALIAS_FS("btrfs");