Skip to content

Commit 1bd5bcc

Browse files
author
Kent Overstreet
committed
bcachefs: Split out btree_key_cache_types.h
More consistent organization. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 4d6128d commit 1bd5bcc

2 files changed

Lines changed: 31 additions & 26 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _BCACHEFS_BTREE_KEY_CACHE_TYPES_H
3+
#define _BCACHEFS_BTREE_KEY_CACHE_TYPES_H
4+
5+
struct btree_key_cache_freelist {
6+
struct bkey_cached *objs[16];
7+
unsigned nr;
8+
};
9+
10+
struct btree_key_cache {
11+
struct mutex lock;
12+
struct rhashtable table;
13+
bool table_init_done;
14+
struct list_head freed_pcpu;
15+
struct list_head freed_nonpcpu;
16+
struct shrinker *shrink;
17+
unsigned shrink_iter;
18+
struct btree_key_cache_freelist __percpu *pcpu_freed;
19+
20+
atomic_long_t nr_freed;
21+
atomic_long_t nr_keys;
22+
atomic_long_t nr_dirty;
23+
};
24+
25+
struct bkey_cached_key {
26+
u32 btree_id;
27+
struct bpos pos;
28+
} __packed __aligned(4);
29+
30+
#endif /* _BCACHEFS_BTREE_KEY_CACHE_TYPES_H */

fs/bcachefs/btree_types.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <linux/list.h>
66
#include <linux/rhashtable.h>
77

8-
//#include "bkey_methods.h"
8+
#include "btree_key_cache_types.h"
99
#include "buckets_types.h"
1010
#include "darray.h"
1111
#include "errcode.h"
@@ -312,31 +312,6 @@ struct btree_iter {
312312
#endif
313313
};
314314

315-
struct btree_key_cache_freelist {
316-
struct bkey_cached *objs[16];
317-
unsigned nr;
318-
};
319-
320-
struct btree_key_cache {
321-
struct mutex lock;
322-
struct rhashtable table;
323-
bool table_init_done;
324-
struct list_head freed_pcpu;
325-
struct list_head freed_nonpcpu;
326-
struct shrinker *shrink;
327-
unsigned shrink_iter;
328-
struct btree_key_cache_freelist __percpu *pcpu_freed;
329-
330-
atomic_long_t nr_freed;
331-
atomic_long_t nr_keys;
332-
atomic_long_t nr_dirty;
333-
};
334-
335-
struct bkey_cached_key {
336-
u32 btree_id;
337-
struct bpos pos;
338-
} __packed __aligned(4);
339-
340315
#define BKEY_CACHED_ACCESSED 0
341316
#define BKEY_CACHED_DIRTY 1
342317

0 commit comments

Comments
 (0)