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
69426613
Commit
69426613
authored
Feb 23, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: improve move_gap()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
95ffc7fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
fs/bcachefs/btree_journal_iter.c
fs/bcachefs/btree_journal_iter.c
+2
-4
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+1
-2
fs/bcachefs/util.h
fs/bcachefs/util.h
+6
-2
No files found.
fs/bcachefs/btree_journal_iter.c
View file @
69426613
...
...
@@ -218,8 +218,7 @@ int bch2_journal_key_insert_take(struct bch_fs *c, enum btree_id id,
journal_iters_move_gap
(
c
,
keys
->
gap
,
idx
);
move_gap
(
keys
->
data
,
keys
->
nr
,
keys
->
size
,
keys
->
gap
,
idx
);
keys
->
gap
=
idx
;
move_gap
(
keys
,
idx
);
keys
->
nr
++
;
keys
->
data
[
keys
->
gap
++
]
=
n
;
...
...
@@ -473,8 +472,7 @@ void bch2_journal_keys_put(struct bch_fs *c)
if
(
!
atomic_dec_and_test
(
&
keys
->
ref
))
return
;
move_gap
(
keys
->
data
,
keys
->
nr
,
keys
->
size
,
keys
->
gap
,
keys
->
nr
);
keys
->
gap
=
keys
->
nr
;
move_gap
(
keys
,
keys
->
nr
);
darray_for_each
(
*
keys
,
i
)
if
(
i
->
allocated
)
...
...
fs/bcachefs/recovery.c
View file @
69426613
...
...
@@ -531,8 +531,7 @@ static int bch2_set_may_go_rw(struct bch_fs *c)
* setting journal_key->overwritten: it will be accessed by multiple
* threads
*/
move_gap
(
keys
->
data
,
keys
->
nr
,
keys
->
size
,
keys
->
gap
,
keys
->
nr
);
keys
->
gap
=
keys
->
nr
;
move_gap
(
keys
,
keys
->
nr
);
set_bit
(
BCH_FS_may_go_rw
,
&
c
->
flags
);
...
...
fs/bcachefs/util.h
View file @
69426613
...
...
@@ -756,8 +756,12 @@ static inline void __move_gap(void *array, size_t element_size,
}
/* Move the gap in a gap buffer: */
#define move_gap(_array, _nr, _size, _old_gap, _new_gap) \
__move_gap(_array, sizeof(_array[0]), _nr, _size, _old_gap, _new_gap)
#define move_gap(_d, _new_gap) \
do { \
__move_gap((_d)->data, sizeof((_d)->data[0]), \
(_d)->nr, (_d)->size, (_d)->gap, _new_gap); \
(_d)->gap = _new_gap; \
} while (0)
#define bubble_sort(_base, _nr, _cmp) \
do { \
...
...
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