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
b2be7c8b
Commit
b2be7c8b
authored
Jul 22, 2018
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: kill bucket mark sector count saturation
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
c6923995
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
69 deletions
+10
-69
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+0
-1
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_gc.c
+0
-3
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+10
-35
fs/bcachefs/buckets.h
fs/bcachefs/buckets.h
+0
-5
fs/bcachefs/trace.h
fs/bcachefs/trace.h
+0
-25
No files found.
fs/bcachefs/bcachefs.h
View file @
b2be7c8b
...
@@ -413,7 +413,6 @@ struct bch_dev {
...
@@ -413,7 +413,6 @@ struct bch_dev {
/* last calculated minimum prio */
/* last calculated minimum prio */
u16
max_last_bucket_io
[
2
];
u16
max_last_bucket_io
[
2
];
atomic_long_t
saturated_count
;
size_t
inc_gen_needs_gc
;
size_t
inc_gen_needs_gc
;
size_t
inc_gen_really_needs_gc
;
size_t
inc_gen_really_needs_gc
;
u64
allocator_journal_seq_flush
;
u64
allocator_journal_seq_flush
;
...
...
fs/bcachefs/btree_gc.c
View file @
b2be7c8b
...
@@ -570,9 +570,6 @@ void bch2_gc(struct bch_fs *c)
...
@@ -570,9 +570,6 @@ void bch2_gc(struct bch_fs *c)
bch2_mark_pending_btree_node_frees
(
c
);
bch2_mark_pending_btree_node_frees
(
c
);
bch2_mark_allocator_buckets
(
c
);
bch2_mark_allocator_buckets
(
c
);
for_each_member_device
(
ca
,
c
,
i
)
atomic_long_set
(
&
ca
->
saturated_count
,
0
);
/* Indicates that gc is no longer in progress: */
/* Indicates that gc is no longer in progress: */
gc_pos_set
(
c
,
gc_phase
(
GC_PHASE_DONE
));
gc_pos_set
(
c
,
gc_phase
(
GC_PHASE_DONE
));
c
->
gc_count
++
;
c
->
gc_count
++
;
...
...
fs/bcachefs/buckets.c
View file @
b2be7c8b
...
@@ -454,17 +454,11 @@ void bch2_mark_alloc_bucket(struct bch_fs *c, struct bch_dev *ca,
...
@@ -454,17 +454,11 @@ void bch2_mark_alloc_bucket(struct bch_fs *c, struct bch_dev *ca,
c
->
gc_pos
.
phase
==
GC_PHASE_DONE
);
c
->
gc_pos
.
phase
==
GC_PHASE_DONE
);
}
}
#define
saturated_add(ca, dst, src, max)
\
#define
checked_add(a, b)
\
do { \
do { \
BUG_ON((int) (dst) + (src) < 0); \
unsigned _res = (unsigned) (a) + (b); \
if ((dst) == (max)) \
(a) = _res; \
; \
BUG_ON((a) != _res); \
else if ((dst) + (src) <= (max)) \
dst += (src); \
else { \
dst = (max); \
trace_sectors_saturated(ca); \
} \
} while (0)
} while (0)
void
bch2_mark_metadata_bucket
(
struct
bch_fs
*
c
,
struct
bch_dev
*
ca
,
void
bch2_mark_metadata_bucket
(
struct
bch_fs
*
c
,
struct
bch_dev
*
ca
,
...
@@ -489,9 +483,9 @@ void bch2_mark_metadata_bucket(struct bch_fs *c, struct bch_dev *ca,
...
@@ -489,9 +483,9 @@ void bch2_mark_metadata_bucket(struct bch_fs *c, struct bch_dev *ca,
g
=
bucket
(
ca
,
b
);
g
=
bucket
(
ca
,
b
);
old
=
bucket_data_cmpxchg
(
c
,
ca
,
g
,
new
,
({
old
=
bucket_data_cmpxchg
(
c
,
ca
,
g
,
new
,
({
saturated_add
(
ca
,
new
.
dirty_sectors
,
sectors
,
GC_MAX_SECTORS_USED
);
new
.
data_type
=
type
;
new
.
data_type
=
type
;
checked_add
(
new
.
dirty_sectors
,
sectors
);
new
.
dirty_sectors
+=
sectors
;
}));
}));
rcu_read_unlock
();
rcu_read_unlock
();
...
@@ -525,7 +519,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -525,7 +519,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
u64
journal_seq
,
unsigned
flags
)
u64
journal_seq
,
unsigned
flags
)
{
{
struct
bucket_mark
old
,
new
;
struct
bucket_mark
old
,
new
;
unsigned
saturated
;
struct
bch_dev
*
ca
=
bch_dev_bkey_exists
(
c
,
ptr
->
dev
);
struct
bch_dev
*
ca
=
bch_dev_bkey_exists
(
c
,
ptr
->
dev
);
struct
bucket
*
g
=
PTR_BUCKET
(
ca
,
ptr
);
struct
bucket
*
g
=
PTR_BUCKET
(
ca
,
ptr
);
enum
bch_data_type
data_type
=
type
==
S_META
enum
bch_data_type
data_type
=
type
==
S_META
...
@@ -560,7 +553,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -560,7 +553,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
v
=
atomic64_read
(
&
g
->
_mark
.
v
);
v
=
atomic64_read
(
&
g
->
_mark
.
v
);
do
{
do
{
new
.
v
.
counter
=
old
.
v
.
counter
=
v
;
new
.
v
.
counter
=
old
.
v
.
counter
=
v
;
saturated
=
0
;
/*
/*
* Check this after reading bucket mark to guard against
* Check this after reading bucket mark to guard against
...
@@ -574,17 +566,10 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -574,17 +566,10 @@ static void bch2_mark_pointer(struct bch_fs *c,
return
;
return
;
}
}
if
(
!
ptr
->
cached
&&
if
(
!
ptr
->
cached
)
new
.
dirty_sectors
==
GC_MAX_SECTORS_USED
&&
checked_add
(
new
.
dirty_sectors
,
sectors
);
sectors
<
0
)
saturated
=
-
sectors
;
if
(
ptr
->
cached
)
saturated_add
(
ca
,
new
.
cached_sectors
,
sectors
,
GC_MAX_SECTORS_USED
);
else
else
saturated_add
(
ca
,
new
.
dirty_sectors
,
sectors
,
checked_add
(
new
.
cached_sectors
,
sectors
);
GC_MAX_SECTORS_USED
);
if
(
!
new
.
dirty_sectors
&&
if
(
!
new
.
dirty_sectors
&&
!
new
.
cached_sectors
)
{
!
new
.
cached_sectors
)
{
...
@@ -610,16 +595,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -610,16 +595,6 @@ static void bch2_mark_pointer(struct bch_fs *c,
BUG_ON
(
!
(
flags
&
BCH_BUCKET_MARK_MAY_MAKE_UNAVAILABLE
)
&&
BUG_ON
(
!
(
flags
&
BCH_BUCKET_MARK_MAY_MAKE_UNAVAILABLE
)
&&
bucket_became_unavailable
(
c
,
old
,
new
));
bucket_became_unavailable
(
c
,
old
,
new
));
if
(
saturated
&&
atomic_long_add_return
(
saturated
,
&
ca
->
saturated_count
)
>=
bucket_to_sector
(
ca
,
ca
->
free_inc
.
size
))
{
if
(
c
->
gc_thread
)
{
trace_gc_sectors_saturated
(
c
);
wake_up_process
(
c
->
gc_thread
);
}
}
}
}
void
bch2_mark_key
(
struct
bch_fs
*
c
,
struct
bkey_s_c
k
,
void
bch2_mark_key
(
struct
bch_fs
*
c
,
struct
bkey_s_c
k
,
...
...
fs/bcachefs/buckets.h
View file @
b2be7c8b
...
@@ -115,11 +115,6 @@ static inline u8 ptr_stale(struct bch_dev *ca,
...
@@ -115,11 +115,6 @@ static inline u8 ptr_stale(struct bch_dev *ca,
/* bucket gc marks */
/* bucket gc marks */
/* The dirty and cached sector counts saturate. If this occurs,
* reference counting alone will not free the bucket, and a btree
* GC must be performed. */
#define GC_MAX_SECTORS_USED ((1U << 15) - 1)
static
inline
unsigned
bucket_sectors_used
(
struct
bucket_mark
mark
)
static
inline
unsigned
bucket_sectors_used
(
struct
bucket_mark
mark
)
{
{
return
mark
.
dirty_sectors
+
mark
.
cached_sectors
;
return
mark
.
dirty_sectors
+
mark
.
cached_sectors
;
...
...
fs/bcachefs/trace.h
View file @
b2be7c8b
...
@@ -44,21 +44,6 @@ DECLARE_EVENT_CLASS(bkey,
...
@@ -44,21 +44,6 @@ DECLARE_EVENT_CLASS(bkey,
__entry
->
offset
,
__entry
->
size
)
__entry
->
offset
,
__entry
->
size
)
);
);
DECLARE_EVENT_CLASS
(
bch_dev
,
TP_PROTO
(
struct
bch_dev
*
ca
),
TP_ARGS
(
ca
),
TP_STRUCT__entry
(
__array
(
char
,
uuid
,
16
)
),
TP_fast_assign
(
memcpy
(
__entry
->
uuid
,
ca
->
uuid
.
b
,
16
);
),
TP_printk
(
"%pU"
,
__entry
->
uuid
)
);
DECLARE_EVENT_CLASS
(
bch_fs
,
DECLARE_EVENT_CLASS
(
bch_fs
,
TP_PROTO
(
struct
bch_fs
*
c
),
TP_PROTO
(
struct
bch_fs
*
c
),
TP_ARGS
(
c
),
TP_ARGS
(
c
),
...
@@ -361,16 +346,6 @@ DEFINE_EVENT(bch_fs, gc_coalesce_end,
...
@@ -361,16 +346,6 @@ DEFINE_EVENT(bch_fs, gc_coalesce_end,
TP_ARGS
(
c
)
TP_ARGS
(
c
)
);
);
DEFINE_EVENT
(
bch_dev
,
sectors_saturated
,
TP_PROTO
(
struct
bch_dev
*
ca
),
TP_ARGS
(
ca
)
);
DEFINE_EVENT
(
bch_fs
,
gc_sectors_saturated
,
TP_PROTO
(
struct
bch_fs
*
c
),
TP_ARGS
(
c
)
);
DEFINE_EVENT
(
bch_fs
,
gc_cannot_inc_gens
,
DEFINE_EVENT
(
bch_fs
,
gc_cannot_inc_gens
,
TP_PROTO
(
struct
bch_fs
*
c
),
TP_PROTO
(
struct
bch_fs
*
c
),
TP_ARGS
(
c
)
TP_ARGS
(
c
)
...
...
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