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
ed0cd515
Commit
ed0cd515
authored
Nov 23, 2023
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bch2_dev_usage_to_text()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
dafff7e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
26 deletions
+32
-26
fs/bcachefs/buckets.c
fs/bcachefs/buckets.c
+30
-0
fs/bcachefs/buckets.h
fs/bcachefs/buckets.h
+1
-0
fs/bcachefs/sysfs.c
fs/bcachefs/sysfs.c
+1
-26
No files found.
fs/bcachefs/buckets.c
View file @
ed0cd515
...
...
@@ -277,6 +277,36 @@ void bch2_dev_usage_init(struct bch_dev *ca)
ca
->
usage_base
->
d
[
BCH_DATA_free
].
buckets
=
ca
->
mi
.
nbuckets
-
ca
->
mi
.
first_bucket
;
}
void
bch2_dev_usage_to_text
(
struct
printbuf
*
out
,
struct
bch_dev_usage
*
usage
)
{
prt_tab
(
out
);
prt_str
(
out
,
"buckets"
);
prt_tab_rjust
(
out
);
prt_str
(
out
,
"sectors"
);
prt_tab_rjust
(
out
);
prt_str
(
out
,
"fragmented"
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
for
(
unsigned
i
=
0
;
i
<
BCH_DATA_NR
;
i
++
)
{
prt_str
(
out
,
bch2_data_types
[
i
]);
prt_tab
(
out
);
prt_u64
(
out
,
usage
->
d
[
i
].
buckets
);
prt_tab_rjust
(
out
);
prt_u64
(
out
,
usage
->
d
[
i
].
sectors
);
prt_tab_rjust
(
out
);
prt_u64
(
out
,
usage
->
d
[
i
].
fragmented
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
}
prt_str
(
out
,
"ec"
);
prt_tab
(
out
);
prt_u64
(
out
,
usage
->
buckets_ec
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
}
static
void
bch2_dev_usage_update
(
struct
bch_fs
*
c
,
struct
bch_dev
*
ca
,
struct
bch_alloc_v4
old
,
struct
bch_alloc_v4
new
,
...
...
fs/bcachefs/buckets.h
View file @
ed0cd515
...
...
@@ -203,6 +203,7 @@ static inline struct bch_dev_usage bch2_dev_usage_read(struct bch_dev *ca)
}
void
bch2_dev_usage_init
(
struct
bch_dev
*
);
void
bch2_dev_usage_to_text
(
struct
printbuf
*
,
struct
bch_dev_usage
*
);
static
inline
u64
bch2_dev_buckets_reserved
(
struct
bch_dev
*
ca
,
enum
bch_watermark
watermark
)
{
...
...
fs/bcachefs/sysfs.c
View file @
ed0cd515
...
...
@@ -786,32 +786,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
printbuf_tabstop_push
(
out
,
16
);
printbuf_tabstop_push
(
out
,
16
);
prt_tab
(
out
);
prt_str
(
out
,
"buckets"
);
prt_tab_rjust
(
out
);
prt_str
(
out
,
"sectors"
);
prt_tab_rjust
(
out
);
prt_str
(
out
,
"fragmented"
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
for
(
i
=
0
;
i
<
BCH_DATA_NR
;
i
++
)
{
prt_str
(
out
,
bch2_data_types
[
i
]);
prt_tab
(
out
);
prt_u64
(
out
,
stats
.
d
[
i
].
buckets
);
prt_tab_rjust
(
out
);
prt_u64
(
out
,
stats
.
d
[
i
].
sectors
);
prt_tab_rjust
(
out
);
prt_u64
(
out
,
stats
.
d
[
i
].
fragmented
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
}
prt_str
(
out
,
"ec"
);
prt_tab
(
out
);
prt_u64
(
out
,
stats
.
buckets_ec
);
prt_tab_rjust
(
out
);
prt_newline
(
out
);
bch2_dev_usage_to_text
(
out
,
&
stats
);
prt_newline
(
out
);
...
...
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