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
581edb63
Commit
581edb63
authored
Aug 08, 2018
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: mempoolify btree_trans
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
cc1add4a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
13 deletions
+13
-13
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+2
-0
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.c
+5
-10
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_iter.h
+1
-1
fs/bcachefs/fsck.c
fs/bcachefs/fsck.c
+2
-2
fs/bcachefs/super.c
fs/bcachefs/super.c
+3
-0
No files found.
fs/bcachefs/bcachefs.h
View file @
581edb63
...
@@ -580,6 +580,8 @@ struct bch_fs {
...
@@ -580,6 +580,8 @@ struct bch_fs {
struct
mutex
btree_interior_update_lock
;
struct
mutex
btree_interior_update_lock
;
struct
closure_waitlist
btree_interior_update_wait
;
struct
closure_waitlist
btree_interior_update_wait
;
mempool_t
btree_iters_pool
;
struct
workqueue_struct
*
wq
;
struct
workqueue_struct
*
wq
;
/* copygc needs its own workqueue for index updates.. */
/* copygc needs its own workqueue for index updates.. */
struct
workqueue_struct
*
copygc_wq
;
struct
workqueue_struct
*
copygc_wq
;
...
...
fs/bcachefs/btree_iter.c
View file @
581edb63
...
@@ -1648,10 +1648,7 @@ static int btree_trans_realloc_iters(struct btree_trans *trans)
...
@@ -1648,10 +1648,7 @@ static int btree_trans_realloc_iters(struct btree_trans *trans)
bch2_trans_unlock
(
trans
);
bch2_trans_unlock
(
trans
);
new_iters
=
kmalloc
(
sizeof
(
struct
btree_iter
)
*
BTREE_ITER_MAX
,
new_iters
=
mempool_alloc
(
&
trans
->
c
->
btree_iters_pool
,
GFP_NOFS
);
GFP_NOFS
);
if
(
!
new_iters
)
return
-
ENOMEM
;
memcpy
(
new_iters
,
trans
->
iters
,
memcpy
(
new_iters
,
trans
->
iters
,
sizeof
(
struct
btree_iter
)
*
trans
->
nr_iters
);
sizeof
(
struct
btree_iter
)
*
trans
->
nr_iters
);
...
@@ -1679,12 +1676,10 @@ static int btree_trans_realloc_iters(struct btree_trans *trans)
...
@@ -1679,12 +1676,10 @@ static int btree_trans_realloc_iters(struct btree_trans *trans)
return
0
;
return
0
;
}
}
int
bch2_trans_preload_iters
(
struct
btree_trans
*
trans
)
void
bch2_trans_preload_iters
(
struct
btree_trans
*
trans
)
{
{
if
(
trans
->
iters
!=
trans
->
iters_onstack
)
if
(
trans
->
iters
==
trans
->
iters_onstack
)
return
0
;
btree_trans_realloc_iters
(
trans
);
return
btree_trans_realloc_iters
(
trans
);
}
}
static
struct
btree_iter
*
__btree_trans_get_iter
(
struct
btree_trans
*
trans
,
static
struct
btree_iter
*
__btree_trans_get_iter
(
struct
btree_trans
*
trans
,
...
@@ -1868,7 +1863,7 @@ int bch2_trans_exit(struct btree_trans *trans)
...
@@ -1868,7 +1863,7 @@ int bch2_trans_exit(struct btree_trans *trans)
kfree
(
trans
->
mem
);
kfree
(
trans
->
mem
);
if
(
trans
->
iters
!=
trans
->
iters_onstack
)
if
(
trans
->
iters
!=
trans
->
iters_onstack
)
kfree
(
trans
->
iters
);
mempool_free
(
trans
->
iters
,
&
trans
->
c
->
btree_iters_pool
);
trans
->
mem
=
(
void
*
)
0x1
;
trans
->
mem
=
(
void
*
)
0x1
;
trans
->
iters
=
(
void
*
)
0x1
;
trans
->
iters
=
(
void
*
)
0x1
;
return
ret
;
return
ret
;
...
...
fs/bcachefs/btree_iter.h
View file @
581edb63
...
@@ -270,7 +270,7 @@ static inline int btree_iter_err(struct bkey_s_c k)
...
@@ -270,7 +270,7 @@ static inline int btree_iter_err(struct bkey_s_c k)
/* new multiple iterator interface: */
/* new multiple iterator interface: */
int
bch2_trans_preload_iters
(
struct
btree_trans
*
);
void
bch2_trans_preload_iters
(
struct
btree_trans
*
);
void
bch2_trans_iter_free
(
struct
btree_trans
*
,
void
bch2_trans_iter_free
(
struct
btree_trans
*
,
struct
btree_iter
*
);
struct
btree_iter
*
);
...
...
fs/bcachefs/fsck.c
View file @
581edb63
...
@@ -398,7 +398,7 @@ static int check_dirents(struct bch_fs *c)
...
@@ -398,7 +398,7 @@ static int check_dirents(struct bch_fs *c)
bch2_trans_init
(
&
trans
,
c
);
bch2_trans_init
(
&
trans
,
c
);
BUG_ON
(
bch2_trans_preload_iters
(
&
trans
)
);
bch2_trans_preload_iters
(
&
trans
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_DIRENTS
,
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_DIRENTS
,
POS
(
BCACHEFS_ROOT_INO
,
0
),
0
);
POS
(
BCACHEFS_ROOT_INO
,
0
),
0
);
...
@@ -539,7 +539,7 @@ static int check_xattrs(struct bch_fs *c)
...
@@ -539,7 +539,7 @@ static int check_xattrs(struct bch_fs *c)
bch2_trans_init
(
&
trans
,
c
);
bch2_trans_init
(
&
trans
,
c
);
BUG_ON
(
bch2_trans_preload_iters
(
&
trans
)
);
bch2_trans_preload_iters
(
&
trans
);
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_XATTRS
,
iter
=
bch2_trans_get_iter
(
&
trans
,
BTREE_ID_XATTRS
,
POS
(
BCACHEFS_ROOT_INO
,
0
),
0
);
POS
(
BCACHEFS_ROOT_INO
,
0
),
0
);
...
...
fs/bcachefs/super.c
View file @
581edb63
...
@@ -372,6 +372,7 @@ static void bch2_fs_free(struct bch_fs *c)
...
@@ -372,6 +372,7 @@ static void bch2_fs_free(struct bch_fs *c)
bch2_fs_compress_exit
(
c
);
bch2_fs_compress_exit
(
c
);
percpu_free_rwsem
(
&
c
->
usage_lock
);
percpu_free_rwsem
(
&
c
->
usage_lock
);
free_percpu
(
c
->
usage_percpu
);
free_percpu
(
c
->
usage_percpu
);
mempool_exit
(
&
c
->
btree_iters_pool
);
mempool_exit
(
&
c
->
btree_bounce_pool
);
mempool_exit
(
&
c
->
btree_bounce_pool
);
bioset_exit
(
&
c
->
btree_bio
);
bioset_exit
(
&
c
->
btree_bio
);
mempool_exit
(
&
c
->
btree_interior_update_pool
);
mempool_exit
(
&
c
->
btree_interior_update_pool
);
...
@@ -600,6 +601,8 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
...
@@ -600,6 +601,8 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
percpu_init_rwsem
(
&
c
->
usage_lock
)
||
percpu_init_rwsem
(
&
c
->
usage_lock
)
||
mempool_init_kvpmalloc_pool
(
&
c
->
btree_bounce_pool
,
1
,
mempool_init_kvpmalloc_pool
(
&
c
->
btree_bounce_pool
,
1
,
btree_bytes
(
c
))
||
btree_bytes
(
c
))
||
mempool_init_kmalloc_pool
(
&
c
->
btree_iters_pool
,
1
,
sizeof
(
struct
btree_iter
)
*
BTREE_ITER_MAX
)
||
bch2_io_clock_init
(
&
c
->
io_clock
[
READ
])
||
bch2_io_clock_init
(
&
c
->
io_clock
[
READ
])
||
bch2_io_clock_init
(
&
c
->
io_clock
[
WRITE
])
||
bch2_io_clock_init
(
&
c
->
io_clock
[
WRITE
])
||
bch2_fs_journal_init
(
&
c
->
journal
)
||
bch2_fs_journal_init
(
&
c
->
journal
)
||
...
...
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