Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3340dee2
Commit
3340dee2
authored
Sep 01, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Add pinned to btree cache not freed counters
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
fa1ab1b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
21 deletions
+36
-21
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_cache.c
+16
-12
fs/bcachefs/btree_types.h
fs/bcachefs/btree_types.h
+20
-9
No files found.
fs/bcachefs/btree_cache.c
View file @
3340dee2
...
...
@@ -19,7 +19,7 @@
#define BTREE_CACHE_NOT_FREED_INCREMENT(counter) \
do { \
if (shrinker_counter) \
bc->not_freed
_##counter
++; \
bc->not_freed
[BCH_BTREE_CACHE_NOT_FREED_##counter]
++; \
} while (0)
const
char
*
const
bch2_btree_node_flags
[]
=
{
...
...
@@ -270,8 +270,10 @@ static int __btree_node_reclaim(struct bch_fs *c, struct btree *b, bool flush, b
if
((
mask
&
BIT_ULL
(
b
->
c
.
btree_id
))
&&
bbpos_cmp
(
bc
->
pinned_nodes_start
,
pos
)
<
0
&&
bbpos_cmp
(
bc
->
pinned_nodes_end
,
pos
)
>=
0
)
bbpos_cmp
(
bc
->
pinned_nodes_end
,
pos
)
>=
0
)
{
BTREE_CACHE_NOT_FREED_INCREMENT
(
pinned
);
return
-
BCH_ERR_ENOMEM_btree_node_reclaim
;
}
wait_on_io:
if
(
b
->
flags
&
((
1U
<<
BTREE_NODE_dirty
)
|
...
...
@@ -433,7 +435,7 @@ static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
if
(
btree_node_accessed
(
b
))
{
clear_btree_node_accessed
(
b
);
bc
->
not_freed
_access_bit
++
;
bc
->
not_freed
[
BCH_BTREE_CACHE_NOT_FREED_access_bit
]
++
;
}
else
if
(
!
btree_node_reclaim
(
c
,
b
,
true
))
{
freed
++
;
btree_node_data_free
(
c
,
b
);
...
...
@@ -1344,6 +1346,13 @@ static void prt_btree_cache_line(struct printbuf *out, const struct bch_fs *c,
prt_printf
(
out
,
" (%u)
\n
"
,
nr
);
}
static
const
char
*
const
bch2_btree_cache_not_freed_reasons_strs
[]
=
{
#define x(n) #n,
BCH_BTREE_CACHE_NOT_FREED_REASONS
()
#undef x
NULL
};
void
bch2_btree_cache_to_text
(
struct
printbuf
*
out
,
const
struct
btree_cache
*
bc
)
{
struct
bch_fs
*
c
=
container_of
(
bc
,
struct
bch_fs
,
btree_cache
);
...
...
@@ -1362,13 +1371,8 @@ void bch2_btree_cache_to_text(struct printbuf *out, const struct btree_cache *bc
prt_newline
(
out
);
prt_printf
(
out
,
"freed:
\t
%u
\n
"
,
bc
->
freed
);
prt_printf
(
out
,
"not freed:
\n
"
);
prt_printf
(
out
,
" dirty
\t
%u
\n
"
,
bc
->
not_freed_dirty
);
prt_printf
(
out
,
" write in flight
\t
%u
\n
"
,
bc
->
not_freed_write_in_flight
);
prt_printf
(
out
,
" read in flight
\t
%u
\n
"
,
bc
->
not_freed_read_in_flight
);
prt_printf
(
out
,
" lock intent failed
\t
%u
\n
"
,
bc
->
not_freed_lock_intent
);
prt_printf
(
out
,
" lock write failed
\t
%u
\n
"
,
bc
->
not_freed_lock_write
);
prt_printf
(
out
,
" access bit
\t
%u
\n
"
,
bc
->
not_freed_access_bit
);
prt_printf
(
out
,
" no evict failed
\t
%u
\n
"
,
bc
->
not_freed_noevict
);
prt_printf
(
out
,
" write blocked
\t
%u
\n
"
,
bc
->
not_freed_write_blocked
);
prt_printf
(
out
,
" will make reachable
\t
%u
\n
"
,
bc
->
not_freed_will_make_reachable
);
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
bc
->
not_freed
);
i
++
)
prt_printf
(
out
,
" %s
\t
%llu
\n
"
,
bch2_btree_cache_not_freed_reasons_strs
[
i
],
bc
->
not_freed
[
i
]);
}
fs/bcachefs/btree_types.h
View file @
3340dee2
...
...
@@ -138,6 +138,25 @@ struct btree {
struct
list_head
list
;
};
#define BCH_BTREE_CACHE_NOT_FREED_REASONS() \
x(lock_intent) \
x(lock_write) \
x(dirty) \
x(read_in_flight) \
x(write_in_flight) \
x(noevict) \
x(write_blocked) \
x(will_make_reachable) \
x(access_bit) \
x(pinned) \
enum
bch_btree_cache_not_freed_reasons
{
#define x(n) BCH_BTREE_CACHE_NOT_FREED_##n,
BCH_BTREE_CACHE_NOT_FREED_REASONS
()
#undef x
BCH_BTREE_CACHE_NOT_FREED_REASONS_NR
,
};
struct
btree_cache
{
struct
rhashtable
table
;
bool
table_init_done
;
...
...
@@ -164,16 +183,8 @@ struct btree_cache {
unsigned
used
;
unsigned
reserve
;
unsigned
freed
;
unsigned
not_freed_lock_intent
;
unsigned
not_freed_lock_write
;
unsigned
not_freed_dirty
;
unsigned
not_freed_read_in_flight
;
unsigned
not_freed_write_in_flight
;
unsigned
not_freed_noevict
;
unsigned
not_freed_write_blocked
;
unsigned
not_freed_will_make_reachable
;
unsigned
not_freed_access_bit
;
atomic_t
dirty
;
u64
not_freed
[
BCH_BTREE_CACHE_NOT_FREED_REASONS_NR
];
struct
shrinker
*
shrink
;
unsigned
used_by_btree
[
BTREE_ID_NR
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment