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
73c27c60
Commit
73c27c60
authored
Feb 14, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: fixes for cached data accounting
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
8c96cfcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+10
-8
No files found.
fs/bcachefs/buckets.c
View file @
73c27c60
...
@@ -432,7 +432,7 @@ static int __bch2_invalidate_bucket(struct bch_fs *c, struct bch_dev *ca,
...
@@ -432,7 +432,7 @@ static int __bch2_invalidate_bucket(struct bch_fs *c, struct bch_dev *ca,
if
(
old
.
cached_sectors
)
if
(
old
.
cached_sectors
)
update_cached_sectors
(
c
,
fs_usage
,
ca
->
dev_idx
,
update_cached_sectors
(
c
,
fs_usage
,
ca
->
dev_idx
,
-
old
.
cached_sectors
);
-
((
s64
)
old
.
cached_sectors
)
);
if
(
!
gc
)
if
(
!
gc
)
*
ret
=
old
;
*
ret
=
old
;
...
@@ -561,7 +561,7 @@ static s64 ptr_disk_sectors_delta(struct extent_ptr_decoded p,
...
@@ -561,7 +561,7 @@ static s64 ptr_disk_sectors_delta(struct extent_ptr_decoded p,
* loop, to avoid racing with the start of gc clearing all the marks - GC does
* loop, to avoid racing with the start of gc clearing all the marks - GC does
* that with the gc pos seqlock held.
* that with the gc pos seqlock held.
*/
*/
static
void
bch2_mark_pointer
(
struct
bch_fs
*
c
,
static
bool
bch2_mark_pointer
(
struct
bch_fs
*
c
,
struct
extent_ptr_decoded
p
,
struct
extent_ptr_decoded
p
,
s64
sectors
,
enum
bch_data_type
data_type
,
s64
sectors
,
enum
bch_data_type
data_type
,
struct
bch_fs_usage
*
fs_usage
,
struct
bch_fs_usage
*
fs_usage
,
...
@@ -589,7 +589,7 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -589,7 +589,7 @@ static void bch2_mark_pointer(struct bch_fs *c,
BUG_ON
(
!
test_bit
(
BCH_FS_ALLOC_READ_DONE
,
&
c
->
flags
));
BUG_ON
(
!
test_bit
(
BCH_FS_ALLOC_READ_DONE
,
&
c
->
flags
));
EBUG_ON
(
!
p
.
ptr
.
cached
&&
EBUG_ON
(
!
p
.
ptr
.
cached
&&
test_bit
(
JOURNAL_REPLAY_DONE
,
&
c
->
journal
.
flags
));
test_bit
(
JOURNAL_REPLAY_DONE
,
&
c
->
journal
.
flags
));
return
;
return
true
;
}
}
if
(
!
p
.
ptr
.
cached
)
if
(
!
p
.
ptr
.
cached
)
...
@@ -620,6 +620,8 @@ static void bch2_mark_pointer(struct bch_fs *c,
...
@@ -620,6 +620,8 @@ static void bch2_mark_pointer(struct bch_fs *c,
bch2_dev_usage_update
(
c
,
ca
,
fs_usage
,
old
,
new
,
gc
);
bch2_dev_usage_update
(
c
,
ca
,
fs_usage
,
old
,
new
,
gc
);
BUG_ON
(
!
gc
&&
bucket_became_unavailable
(
old
,
new
));
BUG_ON
(
!
gc
&&
bucket_became_unavailable
(
old
,
new
));
return
false
;
}
}
static
int
bch2_mark_stripe_ptr
(
struct
bch_fs
*
c
,
static
int
bch2_mark_stripe_ptr
(
struct
bch_fs
*
c
,
...
@@ -702,13 +704,13 @@ static int bch2_mark_extent(struct bch_fs *c, struct bkey_s_c k,
...
@@ -702,13 +704,13 @@ static int bch2_mark_extent(struct bch_fs *c, struct bkey_s_c k,
s64
disk_sectors
=
data_type
==
BCH_DATA_BTREE
s64
disk_sectors
=
data_type
==
BCH_DATA_BTREE
?
sectors
?
sectors
:
ptr_disk_sectors_delta
(
p
,
sectors
);
:
ptr_disk_sectors_delta
(
p
,
sectors
);
bool
stale
=
bch2_mark_pointer
(
c
,
p
,
disk_sectors
,
data_type
,
bch2_mark_pointer
(
c
,
p
,
disk_sectors
,
data_type
,
fs_usage
,
journal_seq
,
flags
,
gc
);
fs_usage
,
journal_seq
,
flags
,
gc
);
if
(
p
.
ptr
.
cached
)
{
if
(
p
.
ptr
.
cached
)
{
update_cached_sectors
(
c
,
fs_usage
,
p
.
ptr
.
dev
,
if
(
disk_sectors
&&
!
stale
)
disk_sectors
);
update_cached_sectors
(
c
,
fs_usage
,
p
.
ptr
.
dev
,
disk_sectors
);
}
else
if
(
!
p
.
ec_nr
)
{
}
else
if
(
!
p
.
ec_nr
)
{
dirty_sectors
+=
disk_sectors
;
dirty_sectors
+=
disk_sectors
;
r
.
e
.
devs
[
r
.
e
.
nr_devs
++
]
=
p
.
ptr
.
dev
;
r
.
e
.
devs
[
r
.
e
.
nr_devs
++
]
=
p
.
ptr
.
dev
;
...
...
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