]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/sysfs.c
Update bcachefs sources to cd779e0cc5 bcachefs: Skip inode unpack/pack in bch2_extent...
[bcachefs-tools-debian] / libbcachefs / sysfs.c
index 103fde97231f994219cd9ee1db4c694ccab92ef0..0f45aef78477326b1f10dd1aeae4fabe385097de 100644 (file)
@@ -175,7 +175,7 @@ read_attribute(minor);
 read_attribute(bucket_size);
 read_attribute(first_bucket);
 read_attribute(nbuckets);
-read_attribute(durability);
+rw_attribute(durability);
 read_attribute(iodone);
 
 read_attribute(io_latency_read);
@@ -425,7 +425,7 @@ SHOW(bch2_fs)
                bch2_btree_updates_to_text(out, c);
 
        if (attr == &sysfs_btree_cache)
-               bch2_btree_cache_to_text(out, c);
+               bch2_btree_cache_to_text(out, &c->btree_cache);
 
        if (attr == &sysfs_btree_key_cache)
                bch2_btree_key_cache_to_text(out, &c->btree_key_cache);
@@ -907,6 +907,19 @@ STORE(bch2_dev)
                mutex_unlock(&c->sb_lock);
        }
 
+       if (attr == &sysfs_durability) {
+               u64 v = strtoul_or_return(buf);
+
+               mutex_lock(&c->sb_lock);
+               mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
+
+               if (v != BCH_MEMBER_DURABILITY(mi)) {
+                       SET_BCH_MEMBER_DURABILITY(mi, v + 1);
+                       bch2_write_super(c);
+               }
+               mutex_unlock(&c->sb_lock);
+       }
+
        if (attr == &sysfs_label) {
                char *tmp;
                int ret;