Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Change zstd compression levels mapping #643

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
67a8e7d
bcachefs: Clamp replicas_required to replicas
Feb 11, 2024
b360f29
bcachefs: Kill unnecessary wakeups in journal reclaim
Jan 31, 2024
8cc173c
bcachefs: Split out journal workqueue
Jan 31, 2024
02e47aa
bcachefs: Avoid setting j->write_work unnecessarily
Jan 31, 2024
17dbd06
bcachefs: Journal writes should be REQ_SYNC|REQ_META
Jan 31, 2024
26d7dfb
bcachefs: Avoid taking journal lock unnecessarily
Jan 31, 2024
b9ce48e
bcachefs: fixup for building in userspace
Jan 16, 2024
d7b8ef8
bcachefs: Improve bch2_dirent_to_text()
Jan 21, 2024
0afdbd8
bcachefs: Workqueues should be WQ_HIGHPRI
Jan 23, 2024
e06a68f
bcachefs: bch2_hash_set_snapshot() -> bch2_hash_set_in_snapshot()
Jan 26, 2024
c7e84c2
bcachefs: Cleanup bch2_dirent_lookup_trans()
Jan 25, 2024
9835aa3
bcachefs: convert journal replay ptrs to darray
Jan 27, 2024
f7a189a
bcachefs: fix split brain message
Jan 27, 2024
ff5631e
bcachefs: improve journal entry read fsck error messages
Jan 27, 2024
9a5bcbf
bcachefs: jset_entry_datetime
Jan 27, 2024
eba16ff
bcachefs: bio per journal buf
Jan 31, 2024
01d9103
bcachefs: closure per journal buf
Jan 31, 2024
feb16b6
bcachefs: better journal pipelining
Jan 31, 2024
35bbaef
bcachefs: btree_and_journal_iter.trans
Jan 22, 2024
26c313d
bcachefs: btree node prefetching in check_topology
Jan 22, 2024
202d48a
bcachefs: Subvolumes may now be renamed
Jan 21, 2024
77c1a2f
bcachefs: Switch to uuid_to_fsid()
Feb 3, 2024
eb61373
bcachefs: Initialize super_block->s_uuid
Feb 3, 2024
08a3c39
bcachefs: Set path->uptodate when no node at level
Jan 24, 2024
3b1b3dc
bcachefs: move fsck_write_inode() to inode.c
Feb 1, 2024
a1a4a02
bcachefs: bump max_active on btree_interior_update_worker
Feb 6, 2024
c59a4ee
bcachefs: Kill some -EINVALs
Feb 6, 2024
3babcb7
bcachefs: Factor out check_subvol_dirent()
Feb 5, 2024
b367aa5
bcachefs: factor out check_inode_backpointer()
Feb 6, 2024
b87b0ef
mm: introduce memalloc_flags_{save,restore}
Jan 26, 2024
15c01c7
mm: introduce PF_MEMALLOC_NORECLAIM, PF_MEMALLOC_NOWARN
Jan 26, 2024
c5ea9e3
bcachefs: bch2_inode_insert()
Jan 26, 2024
e1ea039
bcachefs: bch2_lookup() gives better error message on inode not found
Jan 25, 2024
07ef8cc
mean and variance: Promote to lib/math
Jul 12, 2023
f4c8b7b
eytzinger: Promote to include/linux/
Jan 26, 2024
655d453
bcachefs: bch2_time_stats_to_seq_buf()
Jan 26, 2024
fe4b83e
time_stats: Promote to lib/
Jan 26, 2024
b4b3bc8
bcache: Convert to lib/time_stats
Jan 26, 2024
29b6ad2
time_stats: report lifetime of the stats object
Feb 5, 2024
86818f0
time_stats: split stats-with-quantiles into a separate structure
Feb 1, 2024
5701276
time_stats: fix struct layout bloat
Feb 2, 2024
17fb28e
time_stats: add larger units
Feb 5, 2024
391f67f
time_stats: don't print any output if event count is zero
Feb 3, 2024
708248c
time_stats: allow custom epoch names
Feb 5, 2024
7d66f7f
mean_and_variance: put struct mean_and_variance_weighted on a diet
Feb 8, 2024
097153e
time_stats: shrink time_stat_buffer for better alignment
Feb 5, 2024
45b0213
time_stats: report information in json format
Feb 6, 2024
4d387c7
time_stats: Kill TIME_STATS_HAVE_QUANTILES
Feb 6, 2024
624b65d
mempool: kvmalloc pool
Feb 1, 2024
2c65b9c
bcachefs: kill kvpmalloc()
Feb 1, 2024
8a2922a
bcachefs: thread_with_stdio: eliminate double buffering
Feb 5, 2024
e08c3da
bcachefs: thread_with_stdio: convert to darray
Feb 5, 2024
c6e0a3a
bcachefs: thread_with_stdio: kill thread_with_stdio_done()
Feb 5, 2024
a862a08
bcachefs: thread_with_stdio: fix bch2_stdio_redirect_readline()
Feb 5, 2024
137d837
bcachefs: Thread with file documentation
Feb 3, 2024
8ca424a
darray: lift from bcachefs
Feb 5, 2024
ead021e
thread_with_file: Lift from bcachefs
Feb 5, 2024
635595b
thread_with_stdio: Mark completed in ->release()
Feb 9, 2024
0ecf415
kernel/hung_task.c: export sysctl_hung_task_timeout_secs
Feb 9, 2024
9c3d91b
thread_with_stdio: suppress hung task warning
Feb 9, 2024
07bc83a
bcachefs: Kill more -EIO error codes
Feb 6, 2024
5bdbc77
bcachefs: Check subvol <-> inode pointers in check_subvol()
Feb 6, 2024
630b8c9
bcachefs: Check subvol <-> inode pointers in check_inode()
Feb 6, 2024
3c11dd5
bcachefs: check_inode_dirent_inode()
Feb 7, 2024
741c843
bcachefs: better log message in lookup_inode_for_snapshot()
Feb 8, 2024
24ab7a0
bcachefs: check bi_parent_subvol in check_inode()
Feb 7, 2024
e2e2d01
bcachefs: simplify check_dirent_inode_dirent()
Feb 7, 2024
3b21bac
bcachefs: delete duplicated checks in check_dirent_to_subvol()
Feb 7, 2024
8f27f18
bcachefs: check inode->bi_parent_subvol against dirent
Feb 7, 2024
d88b625
bcachefs: check dirent->d_parent_subvol
Feb 7, 2024
39a9029
bcachefs: Repair subvol dirents that point to non subvols
Jan 21, 2024
586f5e4
bcachefs: bch_subvolume::parent -> creation_parent
Jan 22, 2024
6efdc9d
bcachefs: Fix path where dirent -> subvol missing and we don't fix
Feb 9, 2024
4c0244c
bcachefs: Pass inode bkey to check_path()
Feb 9, 2024
8cd170b
bcachefs: check_path() now prints full inode when reattaching
Feb 9, 2024
c243a1b
bcachefs: Correctly reattach subvolumes
Feb 9, 2024
4f4ff6b
bcachefs: bch2_btree_bit_mod -> bch2_btree_bit_mod_buffered
Feb 9, 2024
f135ed5
bcachefs: bch2_btree_bit_mod()
Feb 9, 2024
dedefe3
bcachefs: bch_subvolume::fs_path_parent
Feb 8, 2024
3c8a373
bcachefs: BTREE_ID_subvolume_children
Jan 21, 2024
54df89f
bcachefs: Check for subvolume children when deleting subvolumes
Feb 10, 2024
9023aac
bcachefs: Pin btree cache in ram for random access in fsck
Jan 23, 2024
684a60f
bcachefs: Save key_cache_path in peek_slot()
Feb 10, 2024
92e51c8
bcachefs: Track iter->ip_allocated at bch2_trans_copy_iter()
Feb 10, 2024
1d8b9db
bcachefs: change zstd compression levels mapping
LRFLEW Jan 28, 2024
54e3822
bcachefs: use non-linear zstd compression levels mapping
LRFLEW Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3536,6 +3536,7 @@ R: Brian Foster <[email protected]>
L: [email protected]
S: Supported
C: irc://irc.oftc.net/bcache
T: git https://evilpiepirate.org/git/bcachefs.git
F: fs/bcachefs/

BDISP ST MEDIA DRIVER
Expand Down Expand Up @@ -5805,6 +5806,13 @@ F: net/ax25/ax25_out.c
F: net/ax25/ax25_timer.c
F: net/ax25/sysctl_net_ax25.c

DARRAY
M: Kent Overstreet <[email protected]>
L: [email protected]
S: Maintained
F: include/linux/darray.h
F: include/linux/darray_types.h

DATA ACCESS MONITOR
M: SeongJae Park <[email protected]>
L: [email protected]
Expand Down Expand Up @@ -8061,6 +8069,12 @@ L: [email protected]
S: Maintained
F: drivers/iommu/exynos-iommu.c

EYTZINGER TREE LIB
M: Kent Overstreet <[email protected]>
L: [email protected]
S: Maintained
F: include/linux/eytzinger.h

F2FS FILE SYSTEM
M: Jaegeuk Kim <[email protected]>
M: Chao Yu <[email protected]>
Expand Down Expand Up @@ -13379,6 +13393,15 @@ S: Maintained
F: drivers/net/mdio/mdio-regmap.c
F: include/linux/mdio/mdio-regmap.h

MEAN AND VARIANCE LIBRARY
M: Daniel B. Hill <[email protected]>
M: Kent Overstreet <[email protected]>
S: Maintained
T: git https://github.com/YellowOnion/linux/
F: include/linux/mean_and_variance.h
F: lib/math/mean_and_variance.c
F: lib/math/mean_and_variance_test.c

MEASUREMENT COMPUTING CIO-DAC IIO DRIVER
M: William Breathitt Gray <[email protected]>
L: [email protected]
Expand Down Expand Up @@ -21856,6 +21879,15 @@ F: Documentation/userspace-api/media/drivers/thp7312.rst
F: drivers/media/i2c/thp7312.c
F: include/uapi/linux/thp7312.h

THREAD WITH FILE
M: Kent Overstreet <[email protected]>
M: Darrick J. Wong <[email protected]>
L: [email protected]
S: Maintained
F: include/linux/thread_with_file.c
F: include/linux/thread_with_file_types.c
F: lib/thread_with_file.c

THUNDERBOLT DMA TRAFFIC TEST DRIVER
M: Isaac Hazan <[email protected]>
L: [email protected]
Expand Down Expand Up @@ -22124,6 +22156,13 @@ F: kernel/time/ntp.c
F: kernel/time/time*.c
F: tools/testing/selftests/timers/

TIME STATS:
M: Kent Overstreet <[email protected]>
M: Darrick J. Wong <[email protected]>
S: Maintained
F: include/linux/time_stats.h
F: lib/time_stats.c

TIPC NETWORK LAYER
M: Jon Maloy <[email protected]>
M: Ying Xue <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions drivers/md/bcache/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config BCACHE
select BLOCK_HOLDER_DEPRECATED if SYSFS
select CRC64
select CLOSURES
select TIME_STATS
help
Allows a block device to be used as cache for other devices; uses
a btree for indexing and the layout is optimized for SSDs.
Expand Down
1 change: 1 addition & 0 deletions drivers/md/bcache/bcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
#include <linux/rbtree.h>
#include <linux/rwsem.h>
#include <linux/refcount.h>
#include <linux/time_stats.h>
#include <linux/types.h>
#include <linux/workqueue.h>
#include <linux/kthread.h>
Expand Down
6 changes: 4 additions & 2 deletions drivers/md/bcache/bset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,13 +1177,15 @@ struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter,

void bch_bset_sort_state_free(struct bset_sort_state *state)
{
time_stats_exit(&state->time);
mempool_exit(&state->pool);
}

int bch_bset_sort_state_init(struct bset_sort_state *state,
unsigned int page_order)
{
spin_lock_init(&state->time.lock);
time_stats_init(&state->time);

state->page_order = page_order;
state->crit_factor = int_sqrt(1 << page_order);
Expand Down Expand Up @@ -1286,7 +1288,7 @@ static void __btree_sort(struct btree_keys *b, struct btree_iter *iter,
bch_bset_build_written_tree(b);

if (!start)
bch_time_stats_update(&state->time, start_time);
time_stats_update(&state->time, start_time);
}

void bch_btree_sort_partial(struct btree_keys *b, unsigned int start,
Expand Down Expand Up @@ -1329,7 +1331,7 @@ void bch_btree_sort_into(struct btree_keys *b, struct btree_keys *new,

btree_mergesort(b, new->set->data, &iter, false, true);

bch_time_stats_update(&state->time, start_time);
time_stats_update(&state->time, start_time);

new->set->size = 0; // XXX: why?
}
Expand Down
1 change: 1 addition & 0 deletions drivers/md/bcache/bset.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define _BCACHE_BSET_H

#include <linux/kernel.h>
#include <linux/time_stats.h>
#include <linux/types.h>

#include "bcache_ondisk.h"
Expand Down
6 changes: 3 additions & 3 deletions drivers/md/bcache/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static void bch_btree_node_read(struct btree *b)
goto err;

bch_btree_node_read_done(b);
bch_time_stats_update(&b->c->btree_read_time, start_time);
time_stats_update(&b->c->btree_read_time, start_time);

return;
err:
Expand Down Expand Up @@ -1852,7 +1852,7 @@ static void bch_btree_gc(struct cache_set *c)
bch_btree_gc_finish(c);
wake_up_allocators(c);

bch_time_stats_update(&c->btree_gc_time, start_time);
time_stats_update(&c->btree_gc_time, start_time);

stats.key_bytes *= sizeof(uint64_t);
stats.data <<= 9;
Expand Down Expand Up @@ -2343,7 +2343,7 @@ static int btree_split(struct btree *b, struct btree_op *op,
btree_node_free(b);
rw_unlock(true, n1);

bch_time_stats_update(&b->c->btree_split_time, start_time);
time_stats_update(&b->c->btree_split_time, start_time);

return 0;
err_free2:
Expand Down
7 changes: 7 additions & 0 deletions drivers/md/bcache/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,9 @@ static CLOSURE_CALLBACK(cache_set_free)

debugfs_remove(c->debug);

time_stats_exit(&c->btree_read_time);
time_stats_exit(&c->btree_split_time);
time_stats_exit(&c->btree_gc_time);
bch_open_buckets_free(c);
bch_btree_cache_free(c);
bch_journal_free(c);
Expand Down Expand Up @@ -1913,6 +1916,10 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
INIT_LIST_HEAD(&c->btree_cache_freed);
INIT_LIST_HEAD(&c->data_buckets);

time_stats_init(&c->btree_gc_time);
time_stats_init(&c->btree_split_time);
time_stats_init(&c->btree_read_time);

iter_size = ((meta_bucket_pages(sb) * PAGE_SECTORS) / sb->block_size + 1) *
sizeof(struct btree_iter_set);

Expand Down
25 changes: 13 additions & 12 deletions drivers/md/bcache/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "features.h"

#include <linux/blkdev.h>
#include <linux/seq_buf.h>
#include <linux/sort.h>
#include <linux/sched/clock.h>

Expand Down Expand Up @@ -79,10 +80,10 @@ read_attribute(active_journal_entries);
read_attribute(backing_dev_name);
read_attribute(backing_dev_uuid);

sysfs_time_stats_attribute(btree_gc, sec, ms);
sysfs_time_stats_attribute(btree_split, sec, us);
sysfs_time_stats_attribute(btree_sort, ms, us);
sysfs_time_stats_attribute(btree_read, ms, us);
read_attribute(btree_gc_times);
read_attribute(btree_split_times);
read_attribute(btree_sort_times);
read_attribute(btree_read_times);

read_attribute(btree_nodes);
read_attribute(btree_used_percent);
Expand Down Expand Up @@ -743,10 +744,10 @@ SHOW(__bch_cache_set)
sysfs_print(btree_cache_max_chain, bch_cache_max_chain(c));
sysfs_print(cache_available_percent, 100 - c->gc_stats.in_use);

sysfs_print_time_stats(&c->btree_gc_time, btree_gc, sec, ms);
sysfs_print_time_stats(&c->btree_split_time, btree_split, sec, us);
sysfs_print_time_stats(&c->sort.time, btree_sort, ms, us);
sysfs_print_time_stats(&c->btree_read_time, btree_read, ms, us);
sysfs_print_time_stats(&c->btree_gc_time, btree_gc_times);
sysfs_print_time_stats(&c->btree_split_time, btree_split_times);
sysfs_print_time_stats(&c->sort.time, btree_sort_times);
sysfs_print_time_stats(&c->btree_read_time, btree_read_times);

sysfs_print(btree_used_percent, bch_btree_used(c));
sysfs_print(btree_nodes, c->gc_stats.nodes);
Expand Down Expand Up @@ -989,10 +990,10 @@ KTYPE(bch_cache_set);
static struct attribute *bch_cache_set_internal_attrs[] = {
&sysfs_active_journal_entries,

sysfs_time_stats_attribute_list(btree_gc, sec, ms)
sysfs_time_stats_attribute_list(btree_split, sec, us)
sysfs_time_stats_attribute_list(btree_sort, ms, us)
sysfs_time_stats_attribute_list(btree_read, ms, us)
&sysfs_btree_gc_times,
&sysfs_btree_split_times,
&sysfs_btree_sort_times,
&sysfs_btree_read_times,

&sysfs_btree_nodes,
&sysfs_btree_used_percent,
Expand Down
30 changes: 0 additions & 30 deletions drivers/md/bcache/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,36 +160,6 @@ int bch_parse_uuid(const char *s, char *uuid)
return i;
}

void bch_time_stats_update(struct time_stats *stats, uint64_t start_time)
{
uint64_t now, duration, last;

spin_lock(&stats->lock);

now = local_clock();
duration = time_after64(now, start_time)
? now - start_time : 0;
last = time_after64(now, stats->last)
? now - stats->last : 0;

stats->max_duration = max(stats->max_duration, duration);

if (stats->last) {
ewma_add(stats->average_duration, duration, 8, 8);

if (stats->average_frequency)
ewma_add(stats->average_frequency, last, 8, 8);
else
stats->average_frequency = last << 8;
} else {
stats->average_duration = duration << 8;
}

stats->last = now ?: 1;

spin_unlock(&stats->lock);
}

/**
* bch_next_delay() - update ratelimiting statistics and calculate next delay
* @d: the struct bch_ratelimit to update
Expand Down
52 changes: 7 additions & 45 deletions drivers/md/bcache/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,6 @@ ssize_t bch_hprint(char *buf, int64_t v);
bool bch_is_zero(const char *p, size_t n);
int bch_parse_uuid(const char *s, char *uuid);

struct time_stats {
spinlock_t lock;
/*
* all fields are in nanoseconds, averages are ewmas stored left shifted
* by 8
*/
uint64_t max_duration;
uint64_t average_duration;
uint64_t average_frequency;
uint64_t last;
};

void bch_time_stats_update(struct time_stats *stats, uint64_t time);

static inline unsigned int local_clock_us(void)
{
return local_clock() >> 10;
Expand All @@ -372,40 +358,16 @@ static inline unsigned int local_clock_us(void)
sysfs_print(name ## _ ## stat ## _ ## units, \
div_u64((stats)->stat >> 8, NSEC_PER_ ## units))

#define sysfs_print_time_stats(stats, name, \
frequency_units, \
duration_units) \
#define sysfs_print_time_stats(stats, name) \
do { \
__print_time_stat(stats, name, \
average_frequency, frequency_units); \
__print_time_stat(stats, name, \
average_duration, duration_units); \
sysfs_print(name ## _ ##max_duration ## _ ## duration_units, \
div_u64((stats)->max_duration, \
NSEC_PER_ ## duration_units)); \
\
sysfs_print(name ## _last_ ## frequency_units, (stats)->last \
? div_s64(local_clock() - (stats)->last, \
NSEC_PER_ ## frequency_units) \
: -1LL); \
if (attr == &sysfs_##name) { \
struct seq_buf seq; \
seq_buf_init(&seq, buf, PAGE_SIZE); \
time_stats_to_seq_buf(&seq, stats, "startup", 0); \
return seq.len; \
} \
} while (0)

#define sysfs_time_stats_attribute(name, \
frequency_units, \
duration_units) \
read_attribute(name ## _average_frequency_ ## frequency_units); \
read_attribute(name ## _average_duration_ ## duration_units); \
read_attribute(name ## _max_duration_ ## duration_units); \
read_attribute(name ## _last_ ## frequency_units)

#define sysfs_time_stats_attribute_list(name, \
frequency_units, \
duration_units) \
&sysfs_ ## name ## _average_frequency_ ## frequency_units, \
&sysfs_ ## name ## _average_duration_ ## duration_units, \
&sysfs_ ## name ## _max_duration_ ## duration_units, \
&sysfs_ ## name ## _last_ ## frequency_units,

#define ewma_add(ewma, val, weight, factor) \
({ \
(ewma) *= (weight) - 1; \
Expand Down
11 changes: 2 additions & 9 deletions fs/bcachefs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ config BCACHEFS_FS
select XXHASH
select SRCU
select SYMBOLIC_ERRNAME
select TIME_STATS
select THREAD_WITH_FILE
help
The bcachefs filesystem - a modern, copy on write filesystem, with
support for multiple devices, compression, checksumming, etc.
Expand Down Expand Up @@ -86,12 +88,3 @@ config BCACHEFS_SIX_OPTIMISTIC_SPIN
Instead of immediately sleeping when attempting to take a six lock that
is held by another thread, spin for a short while, as long as the
thread owning the lock is running.

config MEAN_AND_VARIANCE_UNIT_TEST
tristate "mean_and_variance unit tests" if !KUNIT_ALL_TESTS
depends on KUNIT
depends on BCACHEFS_FS
default KUNIT_ALL_TESTS
help
This option enables the kunit tests for mean_and_variance module.
If unsure, say N.
5 changes: 0 additions & 5 deletions fs/bcachefs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ bcachefs-y := \
checksum.o \
clock.o \
compress.o \
darray.o \
debug.o \
dirent.o \
disk_groups.o \
Expand Down Expand Up @@ -57,7 +56,6 @@ bcachefs-y := \
keylist.o \
logged_ops.o \
lru.o \
mean_and_variance.o \
migrate.o \
move.o \
movinggc.o \
Expand All @@ -82,11 +80,8 @@ bcachefs-y := \
super-io.o \
sysfs.o \
tests.o \
thread_with_file.o \
trace.o \
two_state_shared_lock.o \
util.o \
varint.o \
xattr.o

obj-$(CONFIG_MEAN_AND_VARIANCE_UNIT_TEST) += mean_and_variance_test.o
Loading