diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-12-14 20:52:11 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:52 -0400 |
commit | 350175bf9b0fe5da12a2fd8bfd453a49f038ceb4 (patch) | |
tree | 6118c2363f0ee7570b8d9ac6440b13217b8c322e /fs/bcachefs/sysfs.c | |
parent | f3a37e76cade1469871c4309584ebbc358becf40 (diff) | |
download | linux-350175bf9b0fe5da12a2fd8bfd453a49f038ceb4.tar.gz linux-350175bf9b0fe5da12a2fd8bfd453a49f038ceb4.tar.bz2 linux-350175bf9b0fe5da12a2fd8bfd453a49f038ceb4.zip |
bcachefs: Improved nocow locking
This improves the nocow lock table so that hash table entries have
multiple locks, and locks specify which bucket they're for - i.e. we can
now resolve hash collisions.
This is important because the allocator has to skip buckets that are
locked in the nocow lock table, and previously hash collisions would
cause it to spuriously skip unlocked buckets.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r-- | fs/bcachefs/sysfs.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 5b1f792243cd..6cbdf70f36bd 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -27,6 +27,7 @@ #include "journal.h" #include "keylist.h" #include "move.h" +#include "nocow_locking.h" #include "opts.h" #include "rebalance.h" #include "replicas.h" @@ -477,22 +478,8 @@ SHOW(bch2_fs) bch2_write_refs_to_text(out, c); #endif - if (attr == &sysfs_nocow_lock_table) { - int i, count = 1; - long last, curr = 0; - - last = atomic_long_read(&c->nocow_locks.l[0].v); - for (i = 1; i < BUCKET_NOCOW_LOCKS; i++) { - curr = atomic_long_read(&c->nocow_locks.l[i].v); - if (last != curr) { - prt_printf(out, "%li: %d\n", last, count); - count = 1; - last = curr; - } else - count++; - } - prt_printf(out, "%li: %d\n", last, count); - } + if (attr == &sysfs_nocow_lock_table) + bch2_nocow_locks_to_text(out, &c->nocow_locks); return 0; } |