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
286d6e70
Commit
286d6e70
authored
Sep 30, 2011
by
Chris Mason
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'btrfs-3.0' into for-linus
parents
0a7a0519
b6316429
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
fs/btrfs/file.c
fs/btrfs/file.c
+16
-8
No files found.
fs/btrfs/file.c
View file @
286d6e70
...
@@ -1036,11 +1036,13 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
...
@@ -1036,11 +1036,13 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
* on error we return an unlocked page and the error value
* on error we return an unlocked page and the error value
* on success we return a locked page and 0
* on success we return a locked page and 0
*/
*/
static
int
prepare_uptodate_page
(
struct
page
*
page
,
u64
pos
)
static
int
prepare_uptodate_page
(
struct
page
*
page
,
u64
pos
,
bool
force_uptodate
)
{
{
int
ret
=
0
;
int
ret
=
0
;
if
((
pos
&
(
PAGE_CACHE_SIZE
-
1
))
&&
!
PageUptodate
(
page
))
{
if
(((
pos
&
(
PAGE_CACHE_SIZE
-
1
))
||
force_uptodate
)
&&
!
PageUptodate
(
page
))
{
ret
=
btrfs_readpage
(
NULL
,
page
);
ret
=
btrfs_readpage
(
NULL
,
page
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
...
@@ -1061,7 +1063,7 @@ static int prepare_uptodate_page(struct page *page, u64 pos)
...
@@ -1061,7 +1063,7 @@ static int prepare_uptodate_page(struct page *page, u64 pos)
static
noinline
int
prepare_pages
(
struct
btrfs_root
*
root
,
struct
file
*
file
,
static
noinline
int
prepare_pages
(
struct
btrfs_root
*
root
,
struct
file
*
file
,
struct
page
**
pages
,
size_t
num_pages
,
struct
page
**
pages
,
size_t
num_pages
,
loff_t
pos
,
unsigned
long
first_index
,
loff_t
pos
,
unsigned
long
first_index
,
size_t
write_bytes
)
size_t
write_bytes
,
bool
force_uptodate
)
{
{
struct
extent_state
*
cached_state
=
NULL
;
struct
extent_state
*
cached_state
=
NULL
;
int
i
;
int
i
;
...
@@ -1086,10 +1088,11 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
...
@@ -1086,10 +1088,11 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
}
}
if
(
i
==
0
)
if
(
i
==
0
)
err
=
prepare_uptodate_page
(
pages
[
i
],
pos
);
err
=
prepare_uptodate_page
(
pages
[
i
],
pos
,
force_uptodate
);
if
(
i
==
num_pages
-
1
)
if
(
i
==
num_pages
-
1
)
err
=
prepare_uptodate_page
(
pages
[
i
],
err
=
prepare_uptodate_page
(
pages
[
i
],
pos
+
write_bytes
);
pos
+
write_bytes
,
false
);
if
(
err
)
{
if
(
err
)
{
page_cache_release
(
pages
[
i
]);
page_cache_release
(
pages
[
i
]);
faili
=
i
-
1
;
faili
=
i
-
1
;
...
@@ -1158,6 +1161,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
...
@@ -1158,6 +1161,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
size_t
num_written
=
0
;
size_t
num_written
=
0
;
int
nrptrs
;
int
nrptrs
;
int
ret
=
0
;
int
ret
=
0
;
bool
force_page_uptodate
=
false
;
nrptrs
=
min
((
iov_iter_count
(
i
)
+
PAGE_CACHE_SIZE
-
1
)
/
nrptrs
=
min
((
iov_iter_count
(
i
)
+
PAGE_CACHE_SIZE
-
1
)
/
PAGE_CACHE_SIZE
,
PAGE_CACHE_SIZE
/
PAGE_CACHE_SIZE
,
PAGE_CACHE_SIZE
/
...
@@ -1200,7 +1204,8 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
...
@@ -1200,7 +1204,8 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
* contents of pages from loop to loop
* contents of pages from loop to loop
*/
*/
ret
=
prepare_pages
(
root
,
file
,
pages
,
num_pages
,
ret
=
prepare_pages
(
root
,
file
,
pages
,
num_pages
,
pos
,
first_index
,
write_bytes
);
pos
,
first_index
,
write_bytes
,
force_page_uptodate
);
if
(
ret
)
{
if
(
ret
)
{
btrfs_delalloc_release_space
(
inode
,
btrfs_delalloc_release_space
(
inode
,
num_pages
<<
PAGE_CACHE_SHIFT
);
num_pages
<<
PAGE_CACHE_SHIFT
);
...
@@ -1217,12 +1222,15 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
...
@@ -1217,12 +1222,15 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
if
(
copied
<
write_bytes
)
if
(
copied
<
write_bytes
)
nrptrs
=
1
;
nrptrs
=
1
;
if
(
copied
==
0
)
if
(
copied
==
0
)
{
force_page_uptodate
=
true
;
dirty_pages
=
0
;
dirty_pages
=
0
;
else
}
else
{
force_page_uptodate
=
false
;
dirty_pages
=
(
copied
+
offset
+
dirty_pages
=
(
copied
+
offset
+
PAGE_CACHE_SIZE
-
1
)
>>
PAGE_CACHE_SIZE
-
1
)
>>
PAGE_CACHE_SHIFT
;
PAGE_CACHE_SHIFT
;
}
/*
/*
* If we had a short copy we need to release the excess delaloc
* If we had a short copy we need to release the excess delaloc
...
...
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