mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 14:51:00 +07:00
btrfs: kill btrfs_inode_*time helpers
They just opencode taking address of the timespec member. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
95449a1626
commit
a937b9791e
@ -2467,31 +2467,6 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_gid, struct btrfs_inode_item, gid, 32);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev, struct btrfs_inode_item, rdev, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_inode_flags, struct btrfs_inode_item, flags, 64);
|
||||
|
||||
static inline struct btrfs_timespec *
|
||||
btrfs_inode_atime(struct btrfs_inode_item *inode_item)
|
||||
{
|
||||
unsigned long ptr = (unsigned long)inode_item;
|
||||
ptr += offsetof(struct btrfs_inode_item, atime);
|
||||
return (struct btrfs_timespec *)ptr;
|
||||
}
|
||||
|
||||
static inline struct btrfs_timespec *
|
||||
btrfs_inode_mtime(struct btrfs_inode_item *inode_item)
|
||||
{
|
||||
unsigned long ptr = (unsigned long)inode_item;
|
||||
ptr += offsetof(struct btrfs_inode_item, mtime);
|
||||
return (struct btrfs_timespec *)ptr;
|
||||
}
|
||||
|
||||
static inline struct btrfs_timespec *
|
||||
btrfs_inode_ctime(struct btrfs_inode_item *inode_item)
|
||||
{
|
||||
unsigned long ptr = (unsigned long)inode_item;
|
||||
ptr += offsetof(struct btrfs_inode_item, ctime);
|
||||
return (struct btrfs_timespec *)ptr;
|
||||
}
|
||||
|
||||
BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64);
|
||||
BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec, sec, 64);
|
||||
|
@ -1755,19 +1755,19 @@ static void fill_stack_inode_item(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_stack_inode_flags(inode_item, BTRFS_I(inode)->flags);
|
||||
btrfs_set_stack_inode_block_group(inode_item, 0);
|
||||
|
||||
btrfs_set_stack_timespec_sec(btrfs_inode_atime(inode_item),
|
||||
btrfs_set_stack_timespec_sec(&inode_item->atime,
|
||||
inode->i_atime.tv_sec);
|
||||
btrfs_set_stack_timespec_nsec(btrfs_inode_atime(inode_item),
|
||||
btrfs_set_stack_timespec_nsec(&inode_item->atime,
|
||||
inode->i_atime.tv_nsec);
|
||||
|
||||
btrfs_set_stack_timespec_sec(btrfs_inode_mtime(inode_item),
|
||||
btrfs_set_stack_timespec_sec(&inode_item->mtime,
|
||||
inode->i_mtime.tv_sec);
|
||||
btrfs_set_stack_timespec_nsec(btrfs_inode_mtime(inode_item),
|
||||
btrfs_set_stack_timespec_nsec(&inode_item->mtime,
|
||||
inode->i_mtime.tv_nsec);
|
||||
|
||||
btrfs_set_stack_timespec_sec(btrfs_inode_ctime(inode_item),
|
||||
btrfs_set_stack_timespec_sec(&inode_item->ctime,
|
||||
inode->i_ctime.tv_sec);
|
||||
btrfs_set_stack_timespec_nsec(btrfs_inode_ctime(inode_item),
|
||||
btrfs_set_stack_timespec_nsec(&inode_item->ctime,
|
||||
inode->i_ctime.tv_nsec);
|
||||
}
|
||||
|
||||
@ -1775,7 +1775,6 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
|
||||
{
|
||||
struct btrfs_delayed_node *delayed_node;
|
||||
struct btrfs_inode_item *inode_item;
|
||||
struct btrfs_timespec *tspec;
|
||||
|
||||
delayed_node = btrfs_get_delayed_node(inode);
|
||||
if (!delayed_node)
|
||||
@ -1802,17 +1801,14 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
|
||||
*rdev = btrfs_stack_inode_rdev(inode_item);
|
||||
BTRFS_I(inode)->flags = btrfs_stack_inode_flags(inode_item);
|
||||
|
||||
tspec = btrfs_inode_atime(inode_item);
|
||||
inode->i_atime.tv_sec = btrfs_stack_timespec_sec(tspec);
|
||||
inode->i_atime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
|
||||
inode->i_atime.tv_sec = btrfs_stack_timespec_sec(&inode_item->atime);
|
||||
inode->i_atime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->atime);
|
||||
|
||||
tspec = btrfs_inode_mtime(inode_item);
|
||||
inode->i_mtime.tv_sec = btrfs_stack_timespec_sec(tspec);
|
||||
inode->i_mtime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
|
||||
inode->i_mtime.tv_sec = btrfs_stack_timespec_sec(&inode_item->mtime);
|
||||
inode->i_mtime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->mtime);
|
||||
|
||||
tspec = btrfs_inode_ctime(inode_item);
|
||||
inode->i_ctime.tv_sec = btrfs_stack_timespec_sec(tspec);
|
||||
inode->i_ctime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
|
||||
inode->i_ctime.tv_sec = btrfs_stack_timespec_sec(&inode_item->ctime);
|
||||
inode->i_ctime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->ctime);
|
||||
|
||||
inode->i_generation = BTRFS_I(inode)->generation;
|
||||
BTRFS_I(inode)->index_cnt = (u64)-1;
|
||||
|
@ -3490,7 +3490,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
|
||||
struct btrfs_path *path;
|
||||
struct extent_buffer *leaf;
|
||||
struct btrfs_inode_item *inode_item;
|
||||
struct btrfs_timespec *tspec;
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_key location;
|
||||
unsigned long ptr;
|
||||
@ -3527,17 +3526,14 @@ static void btrfs_read_locked_inode(struct inode *inode)
|
||||
i_gid_write(inode, btrfs_inode_gid(leaf, inode_item));
|
||||
btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
|
||||
|
||||
tspec = btrfs_inode_atime(inode_item);
|
||||
inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, tspec);
|
||||
inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
|
||||
inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->atime);
|
||||
inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->atime);
|
||||
|
||||
tspec = btrfs_inode_mtime(inode_item);
|
||||
inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, tspec);
|
||||
inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
|
||||
inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->mtime);
|
||||
inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->mtime);
|
||||
|
||||
tspec = btrfs_inode_ctime(inode_item);
|
||||
inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, tspec);
|
||||
inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
|
||||
inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->ctime);
|
||||
inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->ctime);
|
||||
|
||||
inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item));
|
||||
BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item);
|
||||
@ -3658,19 +3654,19 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
|
||||
btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->atime,
|
||||
inode->i_atime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->atime,
|
||||
inode->i_atime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->mtime,
|
||||
inode->i_mtime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->mtime,
|
||||
inode->i_mtime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->ctime,
|
||||
inode->i_ctime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->ctime,
|
||||
inode->i_ctime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),
|
||||
|
@ -2471,12 +2471,9 @@ verbose_printk("btrfs: send_utimes %llu\n", ino);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p);
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_ATIME, eb,
|
||||
btrfs_inode_atime(ii));
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_MTIME, eb,
|
||||
btrfs_inode_mtime(ii));
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_CTIME, eb,
|
||||
btrfs_inode_ctime(ii));
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_ATIME, eb, &ii->atime);
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_MTIME, eb, &ii->mtime);
|
||||
TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_CTIME, eb, &ii->ctime);
|
||||
/* TODO Add otime support when the otime patches get into upstream */
|
||||
|
||||
ret = send_cmd(sctx);
|
||||
|
@ -3276,19 +3276,19 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
|
||||
btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->atime,
|
||||
inode->i_atime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->atime,
|
||||
inode->i_atime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->mtime,
|
||||
inode->i_mtime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->mtime,
|
||||
inode->i_mtime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item),
|
||||
btrfs_set_token_timespec_sec(leaf, &item->ctime,
|
||||
inode->i_ctime.tv_sec, &token);
|
||||
btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item),
|
||||
btrfs_set_token_timespec_nsec(leaf, &item->ctime,
|
||||
inode->i_ctime.tv_nsec, &token);
|
||||
|
||||
btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),
|
||||
|
Loading…
Reference in New Issue
Block a user