diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-13 08:32:11 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:13 -0400 |
commit | 721d4ad8eb55bf66ef55b31438b6c8361acf283f (patch) | |
tree | f84119c7664549dc49ac624a4eddf5bb58be6eaf /fs | |
parent | 0f5254aa98befa5187cc4d02584ab0f19d18ff68 (diff) |
bcachefs: Add flags to indicate if inode opts were inherited or explicitly set
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 11 | ||||
-rw-r--r-- | fs/bcachefs/fs-ioctl.c | 9 | ||||
-rw-r--r-- | fs/bcachefs/inode.h | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 19d05a1a0224..f6cf4ccedcb1 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -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 diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c index 701882ce6024..d6563370bec4 100644 --- a/fs/bcachefs/fs-ioctl.c +++ b/fs/bcachefs/fs-ioctl.c @@ -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); } diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index 74fa6ff84111..7bf95f889d35 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -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 |