summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/bcachefs_format.h11
-rw-r--r--fs/bcachefs/fs-ioctl.c9
-rw-r--r--fs/bcachefs/inode.h4
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