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
1a3158ec
Commit
1a3158ec
authored
Jul 17, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: bch2_fiemap(): call trans_begin() on every loop iter
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
7e759572
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
fs/bcachefs/fs.c
fs/bcachefs/fs.c
+22
-18
No files found.
fs/bcachefs/fs.c
View file @
1a3158ec
...
@@ -1095,7 +1095,6 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
...
@@ -1095,7 +1095,6 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
struct
bkey_buf
cur
,
prev
;
struct
bkey_buf
cur
,
prev
;
unsigned
offset_into_extent
,
sectors
;
unsigned
offset_into_extent
,
sectors
;
bool
have_extent
=
false
;
bool
have_extent
=
false
;
u32
snapshot
;
int
ret
=
0
;
int
ret
=
0
;
ret
=
fiemap_prep
(
&
ei
->
v
,
info
,
start
,
&
len
,
FIEMAP_FLAG_SYNC
);
ret
=
fiemap_prep
(
&
ei
->
v
,
info
,
start
,
&
len
,
FIEMAP_FLAG_SYNC
);
...
@@ -1111,20 +1110,29 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
...
@@ -1111,20 +1110,29 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
bch2_bkey_buf_init
(
&
cur
);
bch2_bkey_buf_init
(
&
cur
);
bch2_bkey_buf_init
(
&
prev
);
bch2_bkey_buf_init
(
&
prev
);
trans
=
bch2_trans_get
(
c
);
trans
=
bch2_trans_get
(
c
);
retry:
bch2_trans_iter_init
(
trans
,
&
iter
,
BTREE_ID_extents
,
POS
(
ei
->
v
.
i_ino
,
start
),
0
);
while
(
true
)
{
enum
btree_id
data_btree
=
BTREE_ID_extents
;
bch2_trans_begin
(
trans
);
bch2_trans_begin
(
trans
);
u32
snapshot
;
ret
=
bch2_subvolume_get_snapshot
(
trans
,
ei
->
ei_inum
.
subvol
,
&
snapshot
);
ret
=
bch2_subvolume_get_snapshot
(
trans
,
ei
->
ei_inum
.
subvol
,
&
snapshot
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
bch2_trans_iter_init
(
trans
,
&
iter
,
BTREE_ID_extents
,
bch2_btree_iter_set_snapshot
(
&
iter
,
snapshot
);
SPOS
(
ei
->
v
.
i_ino
,
start
,
snapshot
),
0
);
while
(
!
(
ret
=
btree_trans_too_many_iters
(
trans
))
&&
k
=
bch2_btree_iter_peek_upto
(
&
iter
,
end
);
(
k
=
bch2_btree_iter_peek_upto
(
&
iter
,
end
)).
k
&&
ret
=
bkey_err
(
k
);
!
(
ret
=
bkey_err
(
k
)))
{
if
(
ret
)
enum
btree_id
data_btree
=
BTREE_ID_extents
;
goto
err
;
if
(
!
k
.
k
)
break
;
if
(
!
bkey_extent_is_data
(
k
.
k
)
&&
if
(
!
bkey_extent_is_data
(
k
.
k
)
&&
k
.
k
->
type
!=
KEY_TYPE_reservation
)
{
k
.
k
->
type
!=
KEY_TYPE_reservation
)
{
...
@@ -1169,16 +1177,12 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
...
@@ -1169,16 +1177,12 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
bch2_btree_iter_set_pos
(
&
iter
,
bch2_btree_iter_set_pos
(
&
iter
,
POS
(
iter
.
pos
.
inode
,
iter
.
pos
.
offset
+
sectors
));
POS
(
iter
.
pos
.
inode
,
iter
.
pos
.
offset
+
sectors
));
err:
ret
=
bch2_trans_relock
(
trans
);
if
(
ret
&&
if
(
ret
)
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
)
)
break
;
break
;
}
}
start
=
iter
.
pos
.
offset
;
bch2_trans_iter_exit
(
trans
,
&
iter
);
bch2_trans_iter_exit
(
trans
,
&
iter
);
err:
if
(
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
goto
retry
;
if
(
!
ret
&&
have_extent
)
{
if
(
!
ret
&&
have_extent
)
{
bch2_trans_unlock
(
trans
);
bch2_trans_unlock
(
trans
);
...
...
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