Skip to content

Commit

Permalink
fs: semove set but not checked AOP_FLAG_UNINTERRUPTIBLE flag
Browse files Browse the repository at this point in the history
Commit afddba4 ("fs: introduce write_begin, write_end, and
perform_write aops") introduced AOP_FLAG_UNINTERRUPTIBLE flag which was
checked in pagecache_write_begin(), but that check was removed by
4e02ed4 ("fs: remove prepare_write/commit_write").

Between these two commits, commit d941477 ("cifs: Convert cifs to
new aops.") added a check in cifs_write_begin(), but that check was soon
removed by commit a98ee8c ("[CIFS] fix regression in
cifs_write_begin/cifs_write_end").

Therefore, AOP_FLAG_UNINTERRUPTIBLE flag is checked nowhere.  Let's
remove this flag.  This patch has no functionality changes.

Link: http://lkml.kernel.org/r/1489294781-53494-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Tetsuo Handa authored and torvalds committed May 9, 2017
1 parent f44a292 commit c718a97
Showing 9 changed files with 17 additions and 37 deletions.
3 changes: 1 addition & 2 deletions Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
@@ -694,8 +694,7 @@ struct address_space_operations {

write_end: After a successful write_begin, and data copy, write_end must
be called. len is the original len passed to write_begin, and copied
is the amount that was able to be copied (copied == len is always true
if write_begin was called with the AOP_FLAG_UNINTERRUPTIBLE flag).
is the amount that was able to be copied.

The filesystem must take care of unlocking the page and releasing it
refcount, and updating i_size.
13 changes: 5 additions & 8 deletions fs/buffer.c
Original file line number Diff line number Diff line change
@@ -2379,8 +2379,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
goto out;

err = pagecache_write_begin(NULL, mapping, size, 0,
AOP_FLAG_UNINTERRUPTIBLE|AOP_FLAG_CONT_EXPAND,
&page, &fsdata);
AOP_FLAG_CONT_EXPAND, &page, &fsdata);
if (err)
goto out;

@@ -2415,9 +2414,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
}
len = PAGE_SIZE - zerofrom;

err = pagecache_write_begin(file, mapping, curpos, len,
AOP_FLAG_UNINTERRUPTIBLE,
&page, &fsdata);
err = pagecache_write_begin(file, mapping, curpos, len, 0,
&page, &fsdata);
if (err)
goto out;
zero_user(page, zerofrom, len);
@@ -2449,9 +2447,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
}
len = offset - zerofrom;

err = pagecache_write_begin(file, mapping, curpos, len,
AOP_FLAG_UNINTERRUPTIBLE,
&page, &fsdata);
err = pagecache_write_begin(file, mapping, curpos, len, 0,
&page, &fsdata);
if (err)
goto out;
zero_user(page, zerofrom, len);
3 changes: 1 addition & 2 deletions fs/exofs/dir.c
Original file line number Diff line number Diff line change
@@ -405,8 +405,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de,
int err;

lock_page(page);
err = exofs_write_begin(NULL, page->mapping, pos, len,
AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
err = exofs_write_begin(NULL, page->mapping, pos, len, 0, &page, NULL);
if (err)
EXOFS_ERR("exofs_set_link: exofs_write_begin FAILED => %d\n",
err);
4 changes: 2 additions & 2 deletions fs/hfs/extent.c
Original file line number Diff line number Diff line change
@@ -485,8 +485,8 @@ void hfs_file_truncate(struct inode *inode)

/* XXX: Can use generic_cont_expand? */
size = inode->i_size - 1;
res = pagecache_write_begin(NULL, mapping, size+1, 0,
AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
res = pagecache_write_begin(NULL, mapping, size+1, 0, 0,
&page, &fsdata);
if (!res) {
res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
page, fsdata);
5 changes: 2 additions & 3 deletions fs/hfsplus/extents.c
Original file line number Diff line number Diff line change
@@ -545,9 +545,8 @@ void hfsplus_file_truncate(struct inode *inode)
void *fsdata;
loff_t size = inode->i_size;

res = pagecache_write_begin(NULL, mapping, size, 0,
AOP_FLAG_UNINTERRUPTIBLE,
&page, &fsdata);
res = pagecache_write_begin(NULL, mapping, size, 0, 0,
&page, &fsdata);
if (res)
return;
res = pagecache_write_end(NULL, mapping, size,
13 changes: 3 additions & 10 deletions fs/iomap.c
Original file line number Diff line number Diff line change
@@ -158,12 +158,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
ssize_t written = 0;
unsigned int flags = AOP_FLAG_NOFS;

/*
* Copies from kernel address space cannot fail (NFSD is a big user).
*/
if (!iter_is_iovec(i))
flags |= AOP_FLAG_UNINTERRUPTIBLE;

do {
struct page *page;
unsigned long offset; /* Offset into pagecache page */
@@ -291,8 +285,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
return PTR_ERR(rpage);

status = iomap_write_begin(inode, pos, bytes,
AOP_FLAG_NOFS | AOP_FLAG_UNINTERRUPTIBLE,
&page, iomap);
AOP_FLAG_NOFS, &page, iomap);
put_page(rpage);
if (unlikely(status))
return status;
@@ -343,8 +336,8 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,
struct page *page;
int status;

status = iomap_write_begin(inode, pos, bytes,
AOP_FLAG_UNINTERRUPTIBLE | AOP_FLAG_NOFS, &page, iomap);
status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS, &page,
iomap);
if (status)
return status;

2 changes: 1 addition & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
@@ -4766,7 +4766,7 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
struct page *page;
void *fsdata;
int err;
unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE;
unsigned int flags = 0;
if (nofs)
flags |= AOP_FLAG_NOFS;

5 changes: 2 additions & 3 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
@@ -250,9 +250,8 @@ enum positive_aop_returns {
AOP_TRUNCATED_PAGE = 0x80001,
};

#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */
#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */
#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
#define AOP_FLAG_CONT_EXPAND 0x0001 /* called from cont_expand */
#define AOP_FLAG_NOFS 0x0002 /* used by filesystem to direct
* helper code (eg buffer layer)
* to clear GFP_FS from alloc */

6 changes: 0 additions & 6 deletions mm/filemap.c
Original file line number Diff line number Diff line change
@@ -2791,12 +2791,6 @@ ssize_t generic_perform_write(struct file *file,
ssize_t written = 0;
unsigned int flags = 0;

/*
* Copies from kernel address space cannot fail (NFSD is a big user).
*/
if (!iter_is_iovec(i))
flags |= AOP_FLAG_UNINTERRUPTIBLE;

do {
struct page *page;
unsigned long offset; /* Offset into pagecache page */

0 comments on commit c718a97

Please sign in to comment.