Commit 721d4ad8 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Add flags to indicate if inode opts were inherited or explicitly set

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 0f5254aa
......@@ -714,7 +714,8 @@ struct bch_inode_generation {
x(bi_promote_target, 16) \
x(bi_foreground_target, 16) \
x(bi_background_target, 16) \
x(bi_erasure_code, 16)
x(bi_erasure_code, 16) \
x(bi_fields_set, 16)
/* subset of BCH_INODE_FIELDS */
#define BCH_INODE_OPTS() \
......@@ -728,6 +729,14 @@ struct bch_inode_generation {
x(background_target, 16) \
x(erasure_code, 16)
enum inode_opt_id {
#define x(name, ...) \
Inode_opt_##name,
BCH_INODE_OPTS()
#undef x
Inode_opt_nr,
};
enum {
/*
* User flags (get/settable with FS_IOC_*FLAGS, correspond to FS_*_FL
......
......@@ -122,7 +122,14 @@ static int fssetxattr_inode_update_fn(struct bch_inode_info *inode,
{
struct flags_set *s = p;
bi->bi_project = s->projid;
if (s->projid != bi->bi_project) {
if (s->projid)
bi->bi_fields_set |= 1U << Inode_opt_project;
else
bi->bi_fields_set &= ~(1U << Inode_opt_project);
bi->bi_project = s->projid;
}
return bch2_inode_flags_set(inode, bi, p);
}
......
......@@ -80,6 +80,10 @@ static inline void __bch2_inode_opt_set(struct bch_inode_unpacked *inode,
#define x(_name, ...) \
case Opt_##_name: \
inode->bi_##_name = v; \
if (v) \
inode->bi_fields_set |= 1U << Inode_opt_##_name;\
else \
inode->bi_fields_set &= ~(1U << Inode_opt_##_name);\
break;
BCH_INODE_OPTS()
#undef x
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment