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
877dfb34
Commit
877dfb34
authored
Sep 26, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix for partial buffered writes
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
bbd8d203
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
fs/bcachefs/fs-io.c
fs/bcachefs/fs-io.c
+10
-10
No files found.
fs/bcachefs/fs-io.c
View file @
877dfb34
...
...
@@ -756,8 +756,8 @@ static void bch2_set_page_dirty(struct bch_fs *c,
struct
bch_page_state
*
s
=
bch2_page_state
(
page
);
unsigned
i
,
dirty_sectors
=
0
;
WARN_ON
(
page_offset
(
page
)
+
offset
+
len
>
round_up
(
i_size_read
(
&
inode
->
v
),
block_bytes
(
c
)));
WARN_ON
(
(
u64
)
page_offset
(
page
)
+
offset
+
len
>
round_up
(
(
u64
)
i_size_read
(
&
inode
->
v
),
block_bytes
(
c
)));
for
(
i
=
round_down
(
offset
,
block_bytes
(
c
))
>>
9
;
i
<
round_up
(
offset
+
len
,
block_bytes
(
c
))
>>
9
;
...
...
@@ -1704,14 +1704,6 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
if
(
!
copied
)
goto
out
;
nr_pages_copied
=
DIV_ROUND_UP
(
offset
+
copied
,
PAGE_SIZE
);
inode
->
ei_last_dirtied
=
(
unsigned
long
)
current
;
spin_lock
(
&
inode
->
v
.
i_lock
);
if
(
pos
+
copied
>
inode
->
v
.
i_size
)
i_size_write
(
&
inode
->
v
,
pos
+
copied
);
spin_unlock
(
&
inode
->
v
.
i_lock
);
if
(
copied
<
len
&&
((
offset
+
copied
)
&
(
PAGE_SIZE
-
1
)))
{
struct
page
*
page
=
pages
[(
offset
+
copied
)
>>
PAGE_SHIFT
];
...
...
@@ -1722,6 +1714,11 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
}
}
spin_lock
(
&
inode
->
v
.
i_lock
);
if
(
pos
+
copied
>
inode
->
v
.
i_size
)
i_size_write
(
&
inode
->
v
,
pos
+
copied
);
spin_unlock
(
&
inode
->
v
.
i_lock
);
while
(
set_dirty
<
copied
)
{
struct
page
*
page
=
pages
[(
offset
+
set_dirty
)
>>
PAGE_SHIFT
];
unsigned
pg_offset
=
(
offset
+
set_dirty
)
&
(
PAGE_SIZE
-
1
);
...
...
@@ -1737,6 +1734,9 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
set_dirty
+=
pg_len
;
}
nr_pages_copied
=
DIV_ROUND_UP
(
offset
+
copied
,
PAGE_SIZE
);
inode
->
ei_last_dirtied
=
(
unsigned
long
)
current
;
out:
for
(
i
=
nr_pages_copied
;
i
<
nr_pages
;
i
++
)
{
unlock_page
(
pages
[
i
]);
...
...
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