Skip to content

Commit 0d9b7e1

Browse files
committed
btrfs: pass a btrfs_inode to btrfs_set_prop()
Pass a struct btrfs_inode to btrfs_set_prop() as it's an internal interface, allowing to remove some use of BTRFS_I. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e2877c2 commit 0d9b7e1

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

fs/btrfs/ioctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,15 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
375375
return PTR_ERR(trans);
376376

377377
if (comp) {
378-
ret = btrfs_set_prop(trans, inode, "btrfs.compression", comp,
379-
strlen(comp), 0);
378+
ret = btrfs_set_prop(trans, BTRFS_I(inode), "btrfs.compression",
379+
comp, strlen(comp), 0);
380380
if (ret) {
381381
btrfs_abort_transaction(trans, ret);
382382
goto out_end_trans;
383383
}
384384
} else {
385-
ret = btrfs_set_prop(trans, inode, "btrfs.compression", NULL,
386-
0, 0);
385+
ret = btrfs_set_prop(trans, BTRFS_I(inode), "btrfs.compression",
386+
NULL, 0, 0);
387387
if (ret && ret != -ENODATA) {
388388
btrfs_abort_transaction(trans, ret);
389389
goto out_end_trans;

fs/btrfs/props.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name)
104104
return handler->ignore(inode);
105105
}
106106

107-
int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,
107+
int btrfs_set_prop(struct btrfs_trans_handle *trans, struct btrfs_inode *inode,
108108
const char *name, const char *value, size_t value_len,
109109
int flags)
110110
{
@@ -116,29 +116,29 @@ int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,
116116
return -EINVAL;
117117

118118
if (value_len == 0) {
119-
ret = btrfs_setxattr(trans, inode, handler->xattr_name,
119+
ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name,
120120
NULL, 0, flags);
121121
if (ret)
122122
return ret;
123123

124-
ret = handler->apply(inode, NULL, 0);
124+
ret = handler->apply(&inode->vfs_inode, NULL, 0);
125125
ASSERT(ret == 0);
126126

127127
return ret;
128128
}
129129

130-
ret = btrfs_setxattr(trans, inode, handler->xattr_name, value,
130+
ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name, value,
131131
value_len, flags);
132132
if (ret)
133133
return ret;
134-
ret = handler->apply(inode, value, value_len);
134+
ret = handler->apply(&inode->vfs_inode, value, value_len);
135135
if (ret) {
136-
btrfs_setxattr(trans, inode, handler->xattr_name, NULL,
136+
btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name, NULL,
137137
0, flags);
138138
return ret;
139139
}
140140

141-
set_bit(BTRFS_INODE_HAS_PROPS, &BTRFS_I(inode)->runtime_flags);
141+
set_bit(BTRFS_INODE_HAS_PROPS, &inode->runtime_flags);
142142

143143
return 0;
144144
}

fs/btrfs/props.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct btrfs_trans_handle;
1515

1616
int __init btrfs_props_init(void);
1717

18-
int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,
18+
int btrfs_set_prop(struct btrfs_trans_handle *trans, struct btrfs_inode *inode,
1919
const char *name, const char *value, size_t value_len,
2020
int flags);
2121
int btrfs_validate_prop(const struct btrfs_inode *inode, const char *name,

fs/btrfs/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
451451
if (IS_ERR(trans))
452452
return PTR_ERR(trans);
453453

454-
ret = btrfs_set_prop(trans, inode, name, value, size, flags);
454+
ret = btrfs_set_prop(trans, BTRFS_I(inode), name, value, size, flags);
455455
if (!ret) {
456456
inode_inc_iversion(inode);
457457
inode_set_ctime_current(inode);

0 commit comments

Comments
 (0)