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
nexedi
linux
Commits
4da00fd1
Commit
4da00fd1
authored
Dec 16, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'work.write_end' into for-linus
parents
f0bb5aaf
04fff641
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
65 deletions
+52
-65
fs/9p/vfs_addr.c
fs/9p/vfs_addr.c
+4
-11
fs/ceph/addr.c
fs/ceph/addr.c
+8
-6
fs/exofs/inode.c
fs/exofs/inode.c
+30
-38
fs/gfs2/aops.c
fs/gfs2/aops.c
+1
-3
fs/libfs.c
fs/libfs.c
+8
-6
fs/nfs/file.c
fs/nfs/file.c
+1
-1
No files found.
fs/9p/vfs_addr.c
View file @
4da00fd1
...
...
@@ -309,18 +309,10 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
p9_debug
(
P9_DEBUG_VFS
,
"filp %p, mapping %p
\n
"
,
filp
,
mapping
);
if
(
unlikely
(
copied
<
len
))
{
/*
* zero out the rest of the area
*/
unsigned
from
=
pos
&
(
PAGE_SIZE
-
1
);
zero_user
(
page
,
from
+
copied
,
len
-
copied
);
flush_dcache_page
(
page
);
if
(
unlikely
(
copied
<
len
&&
!
PageUptodate
(
page
)))
{
copied
=
0
;
goto
out
;
}
if
(
!
PageUptodate
(
page
))
SetPageUptodate
(
page
);
/*
* No need to use i_size_read() here, the i_size
* cannot change under us because we hold the i_mutex.
...
...
@@ -330,6 +322,7 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
i_size_write
(
inode
,
last_pos
);
}
set_page_dirty
(
page
);
out:
unlock_page
(
page
);
put_page
(
page
);
...
...
fs/ceph/addr.c
View file @
4da00fd1
...
...
@@ -1276,25 +1276,27 @@ static int ceph_write_end(struct file *file, struct address_space *mapping,
struct
page
*
page
,
void
*
fsdata
)
{
struct
inode
*
inode
=
file_inode
(
file
);
unsigned
from
=
pos
&
(
PAGE_SIZE
-
1
);
int
check_cap
=
0
;
dout
(
"write_end file %p inode %p page %p %d~%d (%d)
\n
"
,
file
,
inode
,
page
,
(
int
)
pos
,
(
int
)
copied
,
(
int
)
len
);
/* zero the stale part of the page if we did a short copy */
if
(
copied
<
len
)
zero_user_segment
(
page
,
from
+
copied
,
len
);
if
(
!
PageUptodate
(
page
))
{
if
(
copied
<
len
)
{
copied
=
0
;
goto
out
;
}
SetPageUptodate
(
page
);
}
/* did file size increase? */
if
(
pos
+
copied
>
i_size_read
(
inode
))
check_cap
=
ceph_inode_set_size
(
inode
,
pos
+
copied
);
if
(
!
PageUptodate
(
page
))
SetPageUptodate
(
page
);
set_page_dirty
(
page
);
out:
unlock_page
(
page
);
put_page
(
page
);
...
...
fs/exofs/inode.c
View file @
4da00fd1
...
...
@@ -870,46 +870,31 @@ int exofs_write_begin(struct file *file, struct address_space *mapping,
page
=
*
pagep
;
if
(
page
==
NULL
)
{
ret
=
simple_write_begin
(
file
,
mapping
,
pos
,
len
,
flags
,
pagep
,
fsdata
);
if
(
ret
)
{
EXOFS_DBGMSG
(
"
simpl
e_write_begin failed
\n
"
);
goto
out
;
page
=
grab_cache_page_write_begin
(
mapping
,
pos
>>
PAGE_SHIFT
,
flags
);
if
(
!
page
)
{
EXOFS_DBGMSG
(
"
grab_cache_pag
e_write_begin failed
\n
"
);
return
-
ENOMEM
;
}
page
=
*
pagep
;
*
pagep
=
page
;
}
/* read modify write */
if
(
!
PageUptodate
(
page
)
&&
(
len
!=
PAGE_SIZE
))
{
loff_t
i_size
=
i_size_read
(
mapping
->
host
);
pgoff_t
end_index
=
i_size
>>
PAGE_SHIFT
;
size_t
rlen
;
if
(
page
->
index
<
end_index
)
rlen
=
PAGE_SIZE
;
else
if
(
page
->
index
==
end_index
)
rlen
=
i_size
&
~
PAGE_MASK
;
else
rlen
=
0
;
if
(
!
rlen
)
{
if
(
page
->
index
>
end_index
)
{
clear_highpage
(
page
);
SetPageUptodate
(
page
);
goto
out
;
}
}
else
{
ret
=
_readpage
(
page
,
true
);
if
(
ret
)
{
/*SetPageError was done by _readpage. Is it ok?*/
unlock_page
(
page
);
EXOFS_DBGMSG
(
"__readpage failed
\n
"
);
}
}
out:
if
(
unlikely
(
ret
))
_write_failed
(
mapping
->
host
,
pos
+
len
);
}
return
ret
;
}
...
...
@@ -929,18 +914,25 @@ static int exofs_write_end(struct file *file, struct address_space *mapping,
struct
page
*
page
,
void
*
fsdata
)
{
struct
inode
*
inode
=
mapping
->
host
;
/* According to comment in simple_write_end i_mutex is held */
loff_t
i_size
=
inode
->
i_size
;
int
ret
;
loff_t
last_pos
=
pos
+
copied
;
ret
=
simple_write_end
(
file
,
mapping
,
pos
,
len
,
copied
,
page
,
fsdata
);
if
(
unlikely
(
ret
))
if
(
!
PageUptodate
(
page
))
{
if
(
copied
<
len
)
{
_write_failed
(
inode
,
pos
+
len
);
/* TODO: once simple_write_end marks inode dirty remove */
if
(
i_size
!=
inode
->
i_size
)
copied
=
0
;
goto
out
;
}
SetPageUptodate
(
page
);
}
if
(
last_pos
>
inode
->
i_size
)
{
i_size_write
(
inode
,
last_pos
);
mark_inode_dirty
(
inode
);
return
ret
;
}
set_page_dirty
(
page
);
out:
unlock_page
(
page
);
put_page
(
page
);
return
copied
;
}
static
int
exofs_releasepage
(
struct
page
*
page
,
gfp_t
gfp
)
...
...
fs/gfs2/aops.c
View file @
4da00fd1
...
...
@@ -839,12 +839,10 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
BUG_ON
((
pos
+
len
)
>
(
dibh
->
b_size
-
sizeof
(
struct
gfs2_dinode
)));
kaddr
=
kmap_atomic
(
page
);
memcpy
(
buf
+
pos
,
kaddr
+
pos
,
copied
);
memset
(
kaddr
+
pos
+
copied
,
0
,
len
-
copied
);
flush_dcache_page
(
page
);
kunmap_atomic
(
kaddr
);
if
(
!
PageUptodate
(
page
))
SetPageUptodate
(
page
);
WARN_ON
(
!
PageUptodate
(
page
));
unlock_page
(
page
);
put_page
(
page
);
...
...
fs/libfs.c
View file @
4da00fd1
...
...
@@ -465,6 +465,8 @@ EXPORT_SYMBOL(simple_write_begin);
* is not called, so a filesystem that actually does store data in .write_inode
* should extend on what's done here with a call to mark_inode_dirty() in the
* case that i_size has changed.
*
* Use *ONLY* with simple_readpage()
*/
int
simple_write_end
(
struct
file
*
file
,
struct
address_space
*
mapping
,
loff_t
pos
,
unsigned
len
,
unsigned
copied
,
...
...
@@ -474,14 +476,14 @@ int simple_write_end(struct file *file, struct address_space *mapping,
loff_t
last_pos
=
pos
+
copied
;
/* zero the stale part of the page if we did a short copy */
if
(
!
PageUptodate
(
page
))
{
if
(
copied
<
len
)
{
unsigned
from
=
pos
&
(
PAGE_SIZE
-
1
);
zero_user
(
page
,
from
+
copied
,
len
-
copied
);
}
if
(
!
PageUptodate
(
page
))
SetPageUptodate
(
page
);
}
/*
* No need to use i_size_read() here, the i_size
* cannot change under us because we hold the i_mutex.
...
...
fs/nfs/file.c
View file @
4da00fd1
...
...
@@ -374,7 +374,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
*/
if
(
!
PageUptodate
(
page
))
{
unsigned
pglen
=
nfs_page_length
(
page
);
unsigned
end
=
offset
+
len
;
unsigned
end
=
offset
+
copied
;
if
(
pglen
==
0
)
{
zero_user_segments
(
page
,
0
,
offset
,
...
...
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