aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-12-12 11:39:12 -0500
committerChris Mason <clm@fb.com>2015-02-02 21:39:07 -0500
commita937b9791ec2ee71d5e303d2c02c8c1ad8abff35 (patch)
tree7e6c9da5054020fb19d62896f1085dbc8ccb47f0 /fs
parent95449a1626fb6b643b576b9fbafed02793627577 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.h25
-rw-r--r--fs/btrfs/delayed-inode.c28
-rw-r--r--fs/btrfs/inode.c28
-rw-r--r--fs/btrfs/send.c9
-rw-r--r--fs/btrfs/tree-log.c12
5 files changed, 33 insertions, 69 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 85c697d482c2..54a66fa6beb1 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2467,31 +2467,6 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_gid, struct btrfs_inode_item, gid, 32);
2467BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32); 2467BTRFS_SETGET_STACK_FUNCS(stack_inode_mode, struct btrfs_inode_item, mode, 32);
2468BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev, struct btrfs_inode_item, rdev, 64); 2468BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev, struct btrfs_inode_item, rdev, 64);
2469BTRFS_SETGET_STACK_FUNCS(stack_inode_flags, struct btrfs_inode_item, flags, 64); 2469BTRFS_SETGET_STACK_FUNCS(stack_inode_flags, struct btrfs_inode_item, flags, 64);
2470
2471static inline struct btrfs_timespec *
2472btrfs_inode_atime(struct btrfs_inode_item *inode_item)
2473{
2474 unsigned long ptr = (unsigned long)inode_item;
2475 ptr += offsetof(struct btrfs_inode_item, atime);
2476 return (struct btrfs_timespec *)ptr;
2477}
2478
2479static inline struct btrfs_timespec *
2480btrfs_inode_mtime(struct btrfs_inode_item *inode_item)
2481{
2482 unsigned long ptr = (unsigned long)inode_item;
2483 ptr += offsetof(struct btrfs_inode_item, mtime);
2484 return (struct btrfs_timespec *)ptr;
2485}
2486
2487static inline struct btrfs_timespec *
2488btrfs_inode_ctime(struct btrfs_inode_item *inode_item)
2489{
2490 unsigned long ptr = (unsigned long)inode_item;
2491 ptr += offsetof(struct btrfs_inode_item, ctime);
2492 return (struct btrfs_timespec *)ptr;
2493}
2494
2495BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64); 2470BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64);
2496BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32); 2471BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
2497BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec, sec, 64); 2472BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec, sec, 64);
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index de4e70fb3cbb..116eb4bed8d3 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1755,19 +1755,19 @@ static void fill_stack_inode_item(struct btrfs_trans_handle *trans,
1755 btrfs_set_stack_inode_flags(inode_item, BTRFS_I(inode)->flags); 1755 btrfs_set_stack_inode_flags(inode_item, BTRFS_I(inode)->flags);
1756 btrfs_set_stack_inode_block_group(inode_item, 0); 1756 btrfs_set_stack_inode_block_group(inode_item, 0);
1757 1757
1758 btrfs_set_stack_timespec_sec(btrfs_inode_atime(inode_item), 1758 btrfs_set_stack_timespec_sec(&inode_item->atime,
1759 inode->i_atime.tv_sec); 1759 inode->i_atime.tv_sec);
1760 btrfs_set_stack_timespec_nsec(btrfs_inode_atime(inode_item), 1760 btrfs_set_stack_timespec_nsec(&inode_item->atime,
1761 inode->i_atime.tv_nsec); 1761 inode->i_atime.tv_nsec);
1762 1762
1763 btrfs_set_stack_timespec_sec(btrfs_inode_mtime(inode_item), 1763 btrfs_set_stack_timespec_sec(&inode_item->mtime,
1764 inode->i_mtime.tv_sec); 1764 inode->i_mtime.tv_sec);
1765 btrfs_set_stack_timespec_nsec(btrfs_inode_mtime(inode_item), 1765 btrfs_set_stack_timespec_nsec(&inode_item->mtime,
1766 inode->i_mtime.tv_nsec); 1766 inode->i_mtime.tv_nsec);
1767 1767
1768 btrfs_set_stack_timespec_sec(btrfs_inode_ctime(inode_item), 1768 btrfs_set_stack_timespec_sec(&inode_item->ctime,
1769 inode->i_ctime.tv_sec); 1769 inode->i_ctime.tv_sec);
1770 btrfs_set_stack_timespec_nsec(btrfs_inode_ctime(inode_item), 1770 btrfs_set_stack_timespec_nsec(&inode_item->ctime,
1771 inode->i_ctime.tv_nsec); 1771 inode->i_ctime.tv_nsec);
1772} 1772}
1773 1773
@@ -1775,7 +1775,6 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
1775{ 1775{
1776 struct btrfs_delayed_node *delayed_node; 1776 struct btrfs_delayed_node *delayed_node;
1777 struct btrfs_inode_item *inode_item; 1777 struct btrfs_inode_item *inode_item;
1778 struct btrfs_timespec *tspec;
1779 1778
1780 delayed_node = btrfs_get_delayed_node(inode); 1779 delayed_node = btrfs_get_delayed_node(inode);
1781 if (!delayed_node) 1780 if (!delayed_node)
@@ -1802,17 +1801,14 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
1802 *rdev = btrfs_stack_inode_rdev(inode_item); 1801 *rdev = btrfs_stack_inode_rdev(inode_item);
1803 BTRFS_I(inode)->flags = btrfs_stack_inode_flags(inode_item); 1802 BTRFS_I(inode)->flags = btrfs_stack_inode_flags(inode_item);
1804 1803
1805 tspec = btrfs_inode_atime(inode_item); 1804 inode->i_atime.tv_sec = btrfs_stack_timespec_sec(&inode_item->atime);
1806 inode->i_atime.tv_sec = btrfs_stack_timespec_sec(tspec); 1805 inode->i_atime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->atime);
1807 inode->i_atime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
1808 1806
1809 tspec = btrfs_inode_mtime(inode_item); 1807 inode->i_mtime.tv_sec = btrfs_stack_timespec_sec(&inode_item->mtime);
1810 inode->i_mtime.tv_sec = btrfs_stack_timespec_sec(tspec); 1808 inode->i_mtime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->mtime);
1811 inode->i_mtime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
1812 1809
1813 tspec = btrfs_inode_ctime(inode_item); 1810 inode->i_ctime.tv_sec = btrfs_stack_timespec_sec(&inode_item->ctime);
1814 inode->i_ctime.tv_sec = btrfs_stack_timespec_sec(tspec); 1811 inode->i_ctime.tv_nsec = btrfs_stack_timespec_nsec(&inode_item->ctime);
1815 inode->i_ctime.tv_nsec = btrfs_stack_timespec_nsec(tspec);
1816 1812
1817 inode->i_generation = BTRFS_I(inode)->generation; 1813 inode->i_generation = BTRFS_I(inode)->generation;
1818 BTRFS_I(inode)->index_cnt = (u64)-1; 1814 BTRFS_I(inode)->index_cnt = (u64)-1;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2d14acbdae47..575164d802af 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3490,7 +3490,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
3490 struct btrfs_path *path; 3490 struct btrfs_path *path;
3491 struct extent_buffer *leaf; 3491 struct extent_buffer *leaf;
3492 struct btrfs_inode_item *inode_item; 3492 struct btrfs_inode_item *inode_item;
3493 struct btrfs_timespec *tspec;
3494 struct btrfs_root *root = BTRFS_I(inode)->root; 3493 struct btrfs_root *root = BTRFS_I(inode)->root;
3495 struct btrfs_key location; 3494 struct btrfs_key location;
3496 unsigned long ptr; 3495 unsigned long ptr;
@@ -3527,17 +3526,14 @@ static void btrfs_read_locked_inode(struct inode *inode)
3527 i_gid_write(inode, btrfs_inode_gid(leaf, inode_item)); 3526 i_gid_write(inode, btrfs_inode_gid(leaf, inode_item));
3528 btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item)); 3527 btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
3529 3528
3530 tspec = btrfs_inode_atime(inode_item); 3529 inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->atime);
3531 inode->i_atime.tv_sec = btrfs_timespec_sec(leaf, tspec); 3530 inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->atime);
3532 inode->i_atime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
3533 3531
3534 tspec = btrfs_inode_mtime(inode_item); 3532 inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->mtime);
3535 inode->i_mtime.tv_sec = btrfs_timespec_sec(leaf, tspec); 3533 inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->mtime);
3536 inode->i_mtime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
3537 3534
3538 tspec = btrfs_inode_ctime(inode_item); 3535 inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, &inode_item->ctime);
3539 inode->i_ctime.tv_sec = btrfs_timespec_sec(leaf, tspec); 3536 inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, &inode_item->ctime);
3540 inode->i_ctime.tv_nsec = btrfs_timespec_nsec(leaf, tspec);
3541 3537
3542 inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item)); 3538 inode_set_bytes(inode, btrfs_inode_nbytes(leaf, inode_item));
3543 BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item); 3539 BTRFS_I(inode)->generation = btrfs_inode_generation(leaf, inode_item);
@@ -3658,19 +3654,19 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
3658 btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token); 3654 btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
3659 btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token); 3655 btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
3660 3656
3661 btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item), 3657 btrfs_set_token_timespec_sec(leaf, &item->atime,
3662 inode->i_atime.tv_sec, &token); 3658 inode->i_atime.tv_sec, &token);
3663 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item), 3659 btrfs_set_token_timespec_nsec(leaf, &item->atime,
3664 inode->i_atime.tv_nsec, &token); 3660 inode->i_atime.tv_nsec, &token);
3665 3661
3666 btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item), 3662 btrfs_set_token_timespec_sec(leaf, &item->mtime,
3667 inode->i_mtime.tv_sec, &token); 3663 inode->i_mtime.tv_sec, &token);
3668 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item), 3664 btrfs_set_token_timespec_nsec(leaf, &item->mtime,
3669 inode->i_mtime.tv_nsec, &token); 3665 inode->i_mtime.tv_nsec, &token);
3670 3666
3671 btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item), 3667 btrfs_set_token_timespec_sec(leaf, &item->ctime,
3672 inode->i_ctime.tv_sec, &token); 3668 inode->i_ctime.tv_sec, &token);
3673 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item), 3669 btrfs_set_token_timespec_nsec(leaf, &item->ctime,
3674 inode->i_ctime.tv_nsec, &token); 3670 inode->i_ctime.tv_nsec, &token);
3675 3671
3676 btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode), 3672 btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 804432dbc351..fe5857223515 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2471,12 +2471,9 @@ verbose_printk("btrfs: send_utimes %llu\n", ino);
2471 if (ret < 0) 2471 if (ret < 0)
2472 goto out; 2472 goto out;
2473 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p); 2473 TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p);
2474 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_ATIME, eb, 2474 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_ATIME, eb, &ii->atime);
2475 btrfs_inode_atime(ii)); 2475 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_MTIME, eb, &ii->mtime);
2476 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_MTIME, eb, 2476 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_CTIME, eb, &ii->ctime);
2477 btrfs_inode_mtime(ii));
2478 TLV_PUT_BTRFS_TIMESPEC(sctx, BTRFS_SEND_A_CTIME, eb,
2479 btrfs_inode_ctime(ii));
2480 /* TODO Add otime support when the otime patches get into upstream */ 2477 /* TODO Add otime support when the otime patches get into upstream */
2481 2478
2482 ret = send_cmd(sctx); 2479 ret = send_cmd(sctx);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a26658756537..79f05bc9d6ec 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3276,19 +3276,19 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
3276 btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token); 3276 btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
3277 btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token); 3277 btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
3278 3278
3279 btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item), 3279 btrfs_set_token_timespec_sec(leaf, &item->atime,
3280 inode->i_atime.tv_sec, &token); 3280 inode->i_atime.tv_sec, &token);
3281 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item), 3281 btrfs_set_token_timespec_nsec(leaf, &item->atime,
3282 inode->i_atime.tv_nsec, &token); 3282 inode->i_atime.tv_nsec, &token);
3283 3283
3284 btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item), 3284 btrfs_set_token_timespec_sec(leaf, &item->mtime,
3285 inode->i_mtime.tv_sec, &token); 3285 inode->i_mtime.tv_sec, &token);
3286 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item), 3286 btrfs_set_token_timespec_nsec(leaf, &item->mtime,
3287 inode->i_mtime.tv_nsec, &token); 3287 inode->i_mtime.tv_nsec, &token);
3288 3288
3289 btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item), 3289 btrfs_set_token_timespec_sec(leaf, &item->ctime,
3290 inode->i_ctime.tv_sec, &token); 3290 inode->i_ctime.tv_sec, &token);
3291 btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item), 3291 btrfs_set_token_timespec_nsec(leaf, &item->ctime,
3292 inode->i_ctime.tv_nsec, &token); 3292 inode->i_ctime.tv_nsec, &token);
3293 3293
3294 btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode), 3294 btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),