linux-next: manual merge of the btrfs tree with Linus' tree

From: Stephen Rothwell
Date: Mon Oct 30 2023 - 20:18:48 EST


Hi all,

Today's linux-next merge of the btrfs tree got conflicts in:

fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/transaction.c

between commit:

b1c38a1338c9 ("btrfs: convert to new timestamp accessors")

from Linus' tree and commits:

8b9d032225be ("btrfs: remove redundant root argument from btrfs_update_inode()")
0a5d0dc55fcb ("btrfs: remove redundant root argument from btrfs_update_inode_fallback()")
8b9d032225be ("btrfs: remove redundant root argument from btrfs_update_inode()")
c6e8f898f56f ("btrfs: open code timespec64 in struct btrfs_inode")

from the btrfs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc fs/btrfs/file.c
index 278a4ea651e1,92419cb8508a..000000000000
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@@ -2474,10 -2476,9 +2477,10 @@@ int btrfs_replace_file_extents(struct b
inode_inc_iversion(&inode->vfs_inode);

if (!extent_info || extent_info->update_times)
- inode->vfs_inode.i_mtime = inode_set_ctime_current(&inode->vfs_inode);
+ inode_set_mtime_to_ts(&inode->vfs_inode,
+ inode_set_ctime_current(&inode->vfs_inode));

- ret = btrfs_update_inode(trans, root, inode);
+ ret = btrfs_update_inode(trans, inode);
if (ret)
break;

@@@ -2716,8 -2717,8 +2719,8 @@@ static int btrfs_punch_hole(struct fil

ASSERT(trans != NULL);
inode_inc_iversion(inode);
- inode->i_mtime = inode_set_ctime_current(inode);
+ inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
- ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
+ ret = btrfs_update_inode(trans, BTRFS_I(inode));
updated_inode = true;
btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
diff --cc fs/btrfs/inode.c
index 6e3ce1aecb6e,b388505c91cc..000000000000
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@@ -3922,24 -3928,22 +3928,22 @@@ static void fill_inode_item(struct btrf
btrfs_set_token_inode_nlink(&token, item, inode->i_nlink);

btrfs_set_token_timespec_sec(&token, &item->atime,
- inode->i_atime.tv_sec);
+ inode_get_atime_sec(inode));
btrfs_set_token_timespec_nsec(&token, &item->atime,
- inode->i_atime.tv_nsec);
+ inode_get_atime_nsec(inode));

btrfs_set_token_timespec_sec(&token, &item->mtime,
- inode->i_mtime.tv_sec);
+ inode_get_mtime_sec(inode));
btrfs_set_token_timespec_nsec(&token, &item->mtime,
- inode->i_mtime.tv_nsec);
+ inode_get_mtime_nsec(inode));

btrfs_set_token_timespec_sec(&token, &item->ctime,
- inode_get_ctime(inode).tv_sec);
+ inode_get_ctime_sec(inode));
btrfs_set_token_timespec_nsec(&token, &item->ctime,
- inode_get_ctime(inode).tv_nsec);
+ inode_get_ctime_nsec(inode));

- btrfs_set_token_timespec_sec(&token, &item->otime,
- BTRFS_I(inode)->i_otime.tv_sec);
- btrfs_set_token_timespec_nsec(&token, &item->otime,
- BTRFS_I(inode)->i_otime.tv_nsec);
+ btrfs_set_token_timespec_sec(&token, &item->otime, BTRFS_I(inode)->i_otime_sec);
+ btrfs_set_token_timespec_nsec(&token, &item->otime, BTRFS_I(inode)->i_otime_nsec);

btrfs_set_token_inode_nbytes(&token, item, inode_get_bytes(inode));
btrfs_set_token_inode_generation(&token, item,
@@@ -4132,8 -4135,9 +4135,8 @@@ err
btrfs_i_size_write(dir, dir->vfs_inode.i_size - name->len * 2);
inode_inc_iversion(&inode->vfs_inode);
inode_inc_iversion(&dir->vfs_inode);
- inode_set_ctime_current(&inode->vfs_inode);
- dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode);
+ inode_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode));
- ret = btrfs_update_inode(trans, root, dir);
+ ret = btrfs_update_inode(trans, dir);
out:
return ret;
}
@@@ -4305,8 -4309,8 +4308,8 @@@ static int btrfs_unlink_subvol(struct b

btrfs_i_size_write(dir, dir->vfs_inode.i_size - fname.disk_name.len * 2);
inode_inc_iversion(&dir->vfs_inode);
- dir->vfs_inode.i_mtime = inode_set_ctime_current(&dir->vfs_inode);
+ inode_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode));
- ret = btrfs_update_inode_fallback(trans, root, dir);
+ ret = btrfs_update_inode_fallback(trans, dir);
if (ret)
btrfs_abort_transaction(trans, ret);
out:
@@@ -5583,6 -5586,6 +5586,7 @@@ static struct inode *new_simple_dir(str
struct btrfs_root *root)
{
struct inode *inode = new_inode(dir->i_sb);
++ struct timespec64 mtime;

if (!inode)
return ERR_PTR(-ENOMEM);
@@@ -5600,9 -5603,10 +5604,11 @@@
inode->i_opflags &= ~IOP_XATTR;
inode->i_fop = &simple_dir_operations;
inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
- inode->i_mtime = inode_set_ctime_current(inode);
- inode->i_atime = dir->i_atime;
- BTRFS_I(inode)->i_otime_sec = inode->i_mtime.tv_sec;
- BTRFS_I(inode)->i_otime_nsec = inode->i_mtime.tv_nsec;
+ inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
+ inode_set_atime_to_ts(inode, inode_get_atime(dir));
- BTRFS_I(inode)->i_otime = inode_get_mtime(inode);
++ mtime = inode_get_mtime(inode);
++ BTRFS_I(inode)->i_otime_sec = mtime.tv_sec;
++ BTRFS_I(inode)->i_otime_nsec = mtime.tv_nsec;
inode->i_uid = dir->i_uid;
inode->i_gid = dir->i_gid;

@@@ -6173,6 -6177,6 +6179,7 @@@ int btrfs_create_new_inode(struct btrfs
struct btrfs_key key[2];
u32 sizes[2];
struct btrfs_item_batch batch;
++ struct timespec64 otime;
unsigned long ptr;
int ret;

@@@ -6277,8 -6281,10 +6284,10 @@@
goto discard;
}

- inode->i_mtime = inode_set_ctime_current(inode);
- inode->i_atime = inode->i_mtime;
- BTRFS_I(inode)->i_otime_sec = inode->i_mtime.tv_sec;
- BTRFS_I(inode)->i_otime_nsec = inode->i_mtime.tv_nsec;
+ simple_inode_init_ts(inode);
- BTRFS_I(inode)->i_otime = inode_get_mtime(inode);
++ otime = inode_get_mtime(inode);
++ BTRFS_I(inode)->i_otime_sec = otime.tv_sec;
++ BTRFS_I(inode)->i_otime_nsec = otime.tv_nsec;

/*
* We're going to fill the inode item now, so at this point the inode
@@@ -6443,10 -6449,10 +6452,10 @@@ int btrfs_add_link(struct btrfs_trans_h
* values (the ones it had when the fsync was done).
*/
if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags))
- parent_inode->vfs_inode.i_mtime =
- inode_set_ctime_current(&parent_inode->vfs_inode);
+ inode_set_mtime_to_ts(&parent_inode->vfs_inode,
+ inode_set_ctime_current(&parent_inode->vfs_inode));

- ret = btrfs_update_inode(trans, root, parent_inode);
+ ret = btrfs_update_inode(trans, parent_inode);
if (ret)
btrfs_abort_transaction(trans, ret);
return ret;
diff --cc fs/btrfs/transaction.c
index 38a2775c5c7b,9694a3ca1739..000000000000
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@@ -1860,9 -1911,8 +1911,9 @@@ static noinline int create_pending_snap

btrfs_i_size_write(BTRFS_I(parent_inode), parent_inode->i_size +
fname.disk_name.len * 2);
- parent_inode->i_mtime = inode_set_ctime_current(parent_inode);
+ inode_set_mtime_to_ts(parent_inode,
+ inode_set_ctime_current(parent_inode));
- ret = btrfs_update_inode_fallback(trans, parent_root, BTRFS_I(parent_inode));
+ ret = btrfs_update_inode_fallback(trans, BTRFS_I(parent_inode));
if (ret) {
btrfs_abort_transaction(trans, ret);
goto fail;

Attachment: pgpuq3gi9oRPG.pgp
Description: OpenPGP digital signature