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
5f461e01
Commit
5f461e01
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: convert fpunch to bch2_extent_update()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
54e2264e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
29 deletions
+3
-29
fs/bcachefs/fs-io.c
fs/bcachefs/fs-io.c
+3
-29
No files found.
fs/bcachefs/fs-io.c
View file @
5f461e01
...
...
@@ -2380,7 +2380,6 @@ int bch2_truncate(struct bch_inode_info *inode, struct iattr *iattr)
static
long
bch2_fpunch
(
struct
bch_inode_info
*
inode
,
loff_t
offset
,
loff_t
len
)
{
struct
bch_fs
*
c
=
inode
->
v
.
i_sb
->
s_fs_info
;
u64
ino
=
inode
->
v
.
i_ino
;
u64
discard_start
=
round_up
(
offset
,
PAGE_SIZE
)
>>
9
;
u64
discard_end
=
round_down
(
offset
+
len
,
PAGE_SIZE
)
>>
9
;
int
ret
=
0
;
...
...
@@ -2406,34 +2405,9 @@ static long bch2_fpunch(struct bch_inode_info *inode, loff_t offset, loff_t len)
truncate_pagecache_range
(
&
inode
->
v
,
offset
,
offset
+
len
-
1
);
if
(
discard_start
<
discard_end
)
{
/*
* We need to pass in a disk reservation here because we might
* be splitting a compressed extent into two. This isn't a
* problem with truncate because truncate will never split an
* extent, only truncate it...
*/
struct
disk_reservation
disk_res
=
bch2_disk_reservation_init
(
c
,
0
);
struct
i_sectors_hook
i_sectors_hook
=
i_sectors_hook_init
(
inode
,
0
);
int
ret
;
ret
=
i_sectors_dirty_start
(
c
,
&
i_sectors_hook
);
if
(
unlikely
(
ret
))
goto
err
;
ret
=
bch2_btree_delete_range
(
c
,
BTREE_ID_EXTENTS
,
POS
(
ino
,
discard_start
),
POS
(
ino
,
discard_end
),
ZERO_VERSION
,
&
disk_res
,
&
i_sectors_hook
.
hook
,
&
inode
->
ei_journal_seq
);
ret
=
i_sectors_dirty_finish
(
c
,
&
i_sectors_hook
)
?:
ret
;
}
if
(
discard_start
<
discard_end
)
ret
=
__bch2_fpunch
(
c
,
inode
,
discard_start
,
discard_end
,
&
inode
->
ei_journal_seq
);
err:
bch2_pagecache_block_put
(
&
inode
->
ei_pagecache_lock
);
inode_unlock
(
&
inode
->
v
);
...
...
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