Use the memalloc_nofs scope API
Subsystems (32)
cover Use the memalloc_nofs scope API
This attempt is to remove the use of AOP_FLAG_NOFS and replacing it with the new scope API of memory allocation memalloc_nofs_save() and memalloc_nofs_restore().
Since we change to scope based memory allocation, we no longer need AOP_FLAGS_NOFS parameters and hence this flag was removeed. The only other parameter is AOP_FLAGS_CONT_EXPAND. Since this is only used by reiserfs, we can remove that by creating a function within reiserfs.
With all usages of AOP flags removed, address_operations.write_begin() prototype becomes a little smaller: by removing the flags parameter.
Git: https://github.com/goldwynr/linux/tree/nofs
Signature · 1 line
Goldwyn
PATCH 1/10 fs: buffer - Use memalloc_nofs API to allocate pages
From: Goldwyn Rodrigues <[email protected]>
--- fs/buffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/buffer.c +6 -1
@@ -45,6 +45,7 @@#include <linux/mpage.h> #include <linux/bit_spinlock.h> #include <linux/pagevec.h> +#include <linux/sched/mm.h> #include <trace/events/block.h> static int fsync_buffers_list (spinlock_t *lock,struct list_head *list);
@@ -836,7 +837,8 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, bool retry) {struct buffer_head *bh, *head; -gfp_t gfp =GFP_NOFS ; +gfp_t gfp =GFP_KERNEL ; +unsigned int nofs_flags;long offset;if (retry)
@@ -844,6 +846,7 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, head =NULL ; offset =PAGE_SIZE ; + nofs_flags =memalloc_nofs_save ();while ((offset -= size) >=0 ) { bh =alloc_buffer_head (gfp);if (!bh)
@@ -858,11 +861,13 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,/* Link the buffer to its page */ set_bh_page (bh, page, offset); } +memalloc_nofs_restore (nofs_flags);return head;/* * In case anything failed, we just free everything we got. */ no_grow: +memalloc_nofs_restore (nofs_flags);if (head) { do { bh = head;
Signature · 1 line
2.16.1
Re: [PATCH 01/10] fs: buffer - Use memalloc_nofs API to allocate pages
Quoted 2 lines · Goldwyn Rodrigues
From: Goldwyn Rodrigues <[email protected]>
I am pretty sure we really need a changelog here.
Quoted 28 lines
Signed-off-by Goldwyn Rodrigues <[email protected]>--- fs/buffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/buffer.c +3
-1@@ -45,6 +45,7 @@#include <linux/mpage.h> #include <linux/bit_spinlock.h> #include <linux/pagevec.h> +#include <linux/sched/mm.h> #include <trace/events/block.h> static int fsync_buffers_list (spinlock_t *lock,struct list_head *list);@@ -836,7 +837,8 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, bool retry) {struct buffer_head *bh, *head; -gfp_t gfp =GFP_NOFS ; +gfp_t gfp =GFP_KERNEL ; +unsigned int nofs_flags;long offset;if (retry)
fs/buffer.c struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, · line 849
Quoted 4 lines
fs/buffer.c +1
-0@@ -844,6 +846,7 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, head =NULL ; offset =PAGE_SIZE ; + nofs_flags =memalloc_nofs_save ();
OK, so what is the actual scope here. What kind of context is recursion problematic? This is a helper function and as such it is the caller who knows the fs context. So this is quite opposite to what how the scope API should be used. It is not about pure GFP_NOFS replacement. We really want to document those scopes.
Quoted 19 lines
fs/buffer.c +2
-0while ((offset -= size) >=0 ) { bh =alloc_buffer_head (gfp);if (!bh)@@ -858,11 +861,13 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,/* Link the buffer to its page */ set_bh_page (bh, page, offset); } +memalloc_nofs_restore (nofs_flags);return head;/* * In case anything failed, we just free everything we got. */ no_grow: +memalloc_nofs_restore (nofs_flags);if (head) { do { bh = head;Signature · 1 line
2.16.1
Signature · 2 lines
Michal Hocko SUSE Labs
PATCH 2/10 fs: mpage use memalloc_nofs_save/restore while allocating bios
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- fs/mpage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/mpage.c +5 -1
@@ -30,6 +30,7 @@#include <linux/backing-dev.h> #include <linux/pagevec.h> #include <linux/cleancache.h> +#include <linux/sched/mm.h> #include "internal.h" /*
@@ -614,13 +615,16 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, alloc_new:if (bio ==NULL ) { +unsigned nofs_flag;if (first_unmapped == blocks_per_page) {if (!bdev_write_page (bdev, blocks[0 ] << (blkbits -9 ), page, wbc)) goto out; } + nofs_flag =memalloc_nofs_save (); bio =mpage_alloc (bdev, blocks[0 ] << (blkbits -9 ), -BIO_MAX_PAGES ,GFP_NOFS |__GFP_HIGH); +BIO_MAX_PAGES ,GFP_KERNEL |__GFP_HIGH); +memalloc_nofs_restore (nofs_flag);if (bio ==NULL ) goto confused;
Signature · 1 line
2.16.1
PATCH 3/10 ext4: Use memalloc_nofs_* scope API
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- fs/ext4/inline.c | 21 +++++++++++++-------- fs/ext4/move_extent.c | 12 ++++++++---- 2 files changed, 21 insertions(+), 12 deletions(-)
fs/ext4/inline.c +13 -8
@@ -7,6 +7,7 @@#include <linux/iomap.h> #include <linux/fiemap.h> #include <linux/iversion.h> +#include <linux/sched/mm.h> #include "ext4_jbd2.h" #include "ext4.h"
@@ -525,6 +526,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,struct page *page =NULL ;unsigned from, to;struct ext4_iloc iloc; +int nofs_flags;if (!ext4_has_inline_data (inode)) {/*
@@ -551,9 +553,12 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,/* We cannot recurse into the filesystem as the transaction is already * started */ - flags |=AOP_FLAG_NOFS ; + nofs_flags =memalloc_nofs_save (); page =grab_cache_page_write_begin (mapping,0 , flags); + +memalloc_nofs_restore (nofs_flags); +if (!page) { ret = -ENOMEM ; goto out;
@@ -645,6 +650,8 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,handle_t *handle;struct page *page;struct ext4_iloc iloc; +unsigned nofs_flags; +if (pos + len >ext4_get_max_inline_size (inode)) goto convert;
@@ -675,9 +682,11 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, goto convert; } - flags |=AOP_FLAG_NOFS ; + nofs_flags =memalloc_nofs_save (); page =grab_cache_page_write_begin (mapping,0 , flags); + +memalloc_nofs_restore (nofs_flags);if (!page) { ret = -ENOMEM ; goto out;
@@ -873,17 +882,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, goto out_journal; } -/* -* We cannot recurse into the filesystem as the transaction -* is already started. -*/ - flags |=AOP_FLAG_NOFS ; -if (ret == -ENOSPC ) { +int nofs_flags =memalloc_nofs_save (); ret =ext4_da_convert_inline_data_to_extent (mapping, inode, flags, fsdata); +memalloc_nofs_restore (nofs_flags);ext4_journal_stop (handle);if (ret == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries))
fs/ext4/move_extent.c +8 -4
@@ -8,6 +8,7 @@#include <linux/fs.h> #include <linux/quotaops.h> #include <linux/slab.h> +#include <linux/sched/mm.h> #include "ext4_jbd2.h" #include "ext4.h" #include "ext4_extents.h"
@@ -127,7 +128,7 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, pgoff_t index1, pgoff_t index2, struct page *page[2]) { struct address_space *mapping[2]; -unsigned fl =AOP_FLAG_NOFS ; +unsigned nofs_fl =memalloc_nofs_save ();BUG_ON (!inode1 || !inode2);if (inode1 < inode2) {
@@ -141,11 +142,14 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, mapping[1 ] = inode1->i_mapping; } - page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1, fl); -if (!page[0 ]) + page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1,0 ); +if (!page[0 ]) { +memalloc_nofs_restore (nofs_fl);return -ENOMEM ; + } - page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2, fl); + page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2,0 ); +memalloc_nofs_restore (nofs_fl);if (!page[1 ]) {unlock_page (page[0 ]);put_page (page[0 ]);
Signature · 1 line
2.16.1
PATCH 4/10 f2fs: Use memalloc_nofs_* scope API
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- fs/f2fs/f2fs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +8 -1
@@ -24,6 +24,7 @@#include <linux/bio.h> #include <linux/blkdev.h> #include <linux/quotaops.h> +#include <linux/sched/mm.h> #include <crypto/hash.h> #define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_F2FS_FS_ENCRYPTION)
@@ -1905,6 +1906,8 @@ static inline s64 valid_inode_count(struct f2fs_sb_info *sbi)static inline struct page *f2fs_grab_cache_page (struct address_space *mapping,pgoff_t index,bool for_write) { +struct page *pg =NULL ; +unsigned nofs_flags;#ifdef CONFIG_F2FS_FAULT_INJECTION struct page *page =find_lock_page (mapping, index);
@@ -1918,7 +1921,11 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,#endif if (!for_write)return grab_cache_page (mapping, index); -return grab_cache_page_write_begin (mapping, index,AOP_FLAG_NOFS ); + + nofs_flags =memalloc_nofs_save (); + pg =grab_cache_page_write_begin (mapping, index,0 ); +memalloc_nofs_restore (nofs_flags); +return pg; } static inline struct page *f2fs_pagecache_get_page(
Signature · 1 line
2.16.1
PATCH 5/10 gfs2: Use memalloc_nofs_* scope API
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- fs/gfs2/aops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/gfs2/aops.c +4 -1
@@ -21,6 +21,7 @@#include <linux/gfs2_ondisk.h> #include <linux/backing-dev.h> #include <linux/uio.h> +#include <linux/sched/mm.h> #include <trace/events/writeback.h> #include "gfs2.h"
@@ -671,6 +672,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,pgoff_t index = pos >>PAGE_SHIFT ;unsigned from = pos & (PAGE_SIZE -1 );struct page *page; +unsigned nofs_flags;gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &ip->i_gh); error =gfs2_glock_nq (&ip->i_gh);
@@ -719,8 +721,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, goto out_trans_fail; error = -ENOMEM ; - flags |=AOP_FLAG_NOFS ; + nofs_flags =memalloc_nofs_save (); page =grab_cache_page_write_begin (mapping, index, flags); +memalloc_nofs_restore (nofs_flags); *pagep = page;if (unlikely (!page)) goto out_endtrans;
Signature · 1 line
2.16.1
PATCH 6/10 fs: iomap use memalloc_nofs_* scope API
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
While we are at it, remove the flags parameter from iomap_write_begin() since we passed AOP_FLAG_NOFS to it.
--- fs/iomap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
fs/iomap.c +9 -6
@@ -27,6 +27,7 @@#include <linux/task_io_accounting_ops.h> #include <linux/dax.h> #include <linux/sched/signal.h> +#include <linux/sched/mm.h> #include "internal.h"
@@ -109,19 +110,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) }static int -iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,unsigned flags, +iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,struct page **pagep,struct iomap *iomap) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status =0 ; +unsigned nofs_flags;BUG_ON (pos + len > iomap->offset + iomap->length);if (fatal_signal_pending (current))return -EINTR ; - page =grab_cache_page_write_begin (inode->i_mapping, index, flags); + nofs_flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (inode->i_mapping, index,0 ); +memalloc_nofs_restore (nofs_flags);if (!page)return -ENOMEM ;
@@ -158,7 +162,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,struct iov_iter *i = data;long status =0 ;ssize_t written =0 ; -unsigned int flags =AOP_FLAG_NOFS ; do { struct page *page;
@@ -188,7 +191,7 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,break ; } - status =iomap_write_begin (inode, pos, bytes, flags, &page, + status =iomap_write_begin (inode, pos, bytes, &page, iomap);if (unlikely (status))break ;
@@ -287,7 +290,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 , &page, iomap); + &page, iomap);put_page (rpage);if (unlikely (status))return status;
@@ -338,7 +341,7 @@ 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_NOFS , &page, + status =iomap_write_begin (inode, pos, bytes, &page, iomap);if (status)return status;
Signature · 1 line
2.16.1
Re: [PATCH 06/10] fs: iomap use memalloc_nofs_* scope API
Quoted 34 lines · Goldwyn Rodrigues
From: Goldwyn Rodrigues <[email protected]>
While we are at it, remove the flags parameter from
iomap_write_begin()since we passedAOP_FLAG_NOFSto it.Signed-off-by Goldwyn Rodrigues <[email protected]>--- fs/iomap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)fs/iomap.c +3
-1@@ -27,6 +27,7 @@#include <linux/task_io_accounting_ops.h> #include <linux/dax.h> #include <linux/sched/signal.h> +#include <linux/sched/mm.h> #include "internal.h" @@ -109,19 +110,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) }static int -iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,unsigned flags, +iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,struct page **pagep,struct iomap *iomap) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status =0 ; +unsigned nofs_flags;
fs/iomap.c iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) · line 128
Quoted 10 lines
fs/iomap.c +3
-1BUG_ON (pos + len > iomap->offset + iomap->length);if (fatal_signal_pending (current))return -EINTR ; - page =grab_cache_page_write_begin (inode->i_mapping, index, flags); + nofs_flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (inode->i_mapping, index,0 ); +memalloc_nofs_restore (nofs_flags);
This is wrong. flags are provided by the caller, so the caller decides on the memory allocation scope, not this function.
As it is, I can't say I like this whole patchset. This is not what the scoped memory allocation API was intended for. i.e. it was intended to mark large regions of memory allocation restrictions for disjoint operations, not replace a neat, clean flag interface with a mess of save/restore calls and new ways to screw up error handling....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 06/10] fs: iomap use memalloc_nofs_* scope API
Quoted 49 lines · Dave Chinner
Quoted 34 lines · Goldwyn Rodrigues
From: Goldwyn Rodrigues <[email protected]>
While we are at it, remove the flags parameter from
iomap_write_begin()since we passedAOP_FLAG_NOFSto it.Signed-off-by Goldwyn Rodrigues <[email protected]>--- fs/iomap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)fs/iomap.c +3
-1@@ -27,6 +27,7 @@#include <linux/task_io_accounting_ops.h> #include <linux/dax.h> #include <linux/sched/signal.h> +#include <linux/sched/mm.h> #include "internal.h" @@ -109,19 +110,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) }static int -iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,unsigned flags, +iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,struct page **pagep,struct iomap *iomap) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status =0 ; +unsigned nofs_flags;fs/iomap.c iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) · line 128
Quoted 10 lines
fs/iomap.c +3
-1BUG_ON (pos + len > iomap->offset + iomap->length);if (fatal_signal_pending (current))return -EINTR ; - page =grab_cache_page_write_begin (inode->i_mapping, index, flags); + nofs_flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (inode->i_mapping, index,0 ); +memalloc_nofs_restore (nofs_flags);This is wrong. flags are provided by the caller, so the caller decides on the memory allocation scope, not this function.
Quoted 6 lines
As it is, I can't say I like this whole patchset. This is not what the scoped memory allocation API was intended for. i.e. it was intended to mark large regions of memory allocation restrictions for disjoint operations, not replace a neat, clean flag interface with a mess of save/restore calls and new ways to screw up error handling....
100% agreed! My original plan was to identify reclaim recursion sensitive contexts per fs and then remove explicit GFP_NOFS called solely from those contexts. [1] should help to identify the later. The harderst part is the first part of course. It requires the detailed knowledge of the fs reclaim implementation of course.
[1] http://lkml.kernel.org/r/[email protected]
Signature · 2 lines
Michal Hocko SUSE Labs
Re: [PATCH 06/10] fs: iomap use memalloc_nofs_* scope API
Quoted 42 lines · Michal Hocko
Quoted 41 lines · Dave Chinner
Quoted 40 lines · Goldwyn Rodrigues
From: Goldwyn Rodrigues <[email protected]>
While we are at it, remove the flags parameter from
iomap_write_begin()since we passedAOP_FLAG_NOFSto it.Signed-off-by Goldwyn Rodrigues <[email protected]>--- fs/iomap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)fs/iomap.c +3
-1@@ -27,6 +27,7 @@#include <linux/task_io_accounting_ops.h> #include <linux/dax.h> #include <linux/sched/signal.h> +#include <linux/sched/mm.h> #include "internal.h" @@ -109,19 +110,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) }static int -iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,unsigned flags, +iomap_write_begin (struct inode *inode,loff_t pos,unsigned len,struct page **pagep,struct iomap *iomap) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status =0 ; +unsigned nofs_flags;BUG_ON (pos + len > iomap->offset + iomap->length);if (fatal_signal_pending (current))return -EINTR ;
Quoted 7 lines
Quoted 7 lines
fs/iomap.c iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) · line 128
Quoted 4 lines
fs/iomap.c +3
-1- page =grab_cache_page_write_begin (inode->i_mapping, index, flags); + nofs_flags =memalloc_nofs_save (); + page =grab_cache_page_write_begin (inode->i_mapping, index,0 ); +memalloc_nofs_restore (nofs_flags);This is wrong. flags are provided by the caller, so the caller decides on the memory allocation scope, not this function.
All callers are calling with the same parameter. However, this is not the place to eliminate this. I agree the scope is too narrow.
Quoted 8 lines
Quoted 7 lines
As it is, I can't say I like this whole patchset. This is not what the scoped memory allocation API was intended for. i.e. it was intended to mark large regions of memory allocation restrictions for disjoint operations, not replace a neat, clean flag interface with a mess of save/restore calls and new ways to screw up error handling....
Quoted 5 lines
100% agreed! My original plan was to identify reclaim recursion sensitive contexts per fs and then remove explicit
GFP_NOFScalled solely from those contexts. [1] should help to identify the later. The harderst part is the first part of course. It requires the detailed knowledge of the fs reclaim implementation of course.
Thanks. I misunderstood the scope concept.
In a previous test, I tried converting GFP_NOFS to GFP_KERNEL in order to hang/crash the kernel with heavy I/O in low memory but failed. I tried it with three filesystems. Hopefully, these patches will extract out the positions which need attention.
Quoted 3 lines
Signature · 1 line
Goldwyn
PATCH 7/10 fs: namei use memalloc_nofs_* scope API
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- fs/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/namei.c +6 -1
@@ -39,6 +39,7 @@#include <linux/bitops.h> #include <linux/init_task.h> #include <linux/uaccess.h> +#include <linux/sched/mm.h> #include "internal.h" #include "mount.h"
@@ -4797,7 +4798,7 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)int err;unsigned int flags =0 ;if (nofs) - flags |=AOP_FLAG_NOFS ; + flags =memalloc_nofs_save (); retry: err = pagecache_write_begin(NULL, mapping, 0, len-1,
@@ -4815,8 +4816,12 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) goto retry;mark_inode_dirty (inode); +if (nofs) +memalloc_nofs_restore (flags);return 0 ; fail: +if (nofs) +memalloc_nofs_restore (flags);return err; }EXPORT_SYMBOL (__page_symlink);
Signature · 1 line
2.16.1
PATCH 8/10 fs: Eliminate AOP_FLAG_NOFS
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- include/linux/fs.h | 3 --- mm/filemap.c | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-)
include/linux/fs.h +0 -3
@@ -260,9 +260,6 @@ enum positive_aop_returns { };#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 */ /* * oh the beauties of C type declarations.
mm/filemap.c +1 -5
@@ -3080,12 +3080,8 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index, unsigned flags) {struct page *page; -int fgp_flags =FGP_LOCK |FGP_WRITE |FGP_CREAT ; -if (flags &AOP_FLAG_NOFS ) - fgp_flags |=FGP_NOFS ; - - page =pagecache_get_page (mapping, index, fgp_flags, + page =pagecache_get_page (mapping, index,FGP_LOCK |FGP_WRITE |FGP_CREAT ,mapping_gfp_mask (mapping));if (page)wait_for_stable_page (page);
Signature · 1 line
2.16.1
PATCH 9/10 reiserfs: cont_expand() to eliminate AOP_FLAG_CONT_EXPAND
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
Reiserfs is the only user of AOP_FLAG_CONT_EXPAND. Remove the flag and add a function cont_expand to deal with pos increment.
--- fs/reiserfs/inode.c | 38 +++++++++++++++++++++++++++----------- include/linux/fs.h | 2 -- 2 files changed, 27 insertions(+), 13 deletions(-)
fs/reiserfs/inode.c +27 -11
@@ -2761,13 +2761,6 @@ static int reiserfs_write_begin(struct file *file,int old_ref =0 ; inode = mapping->host; - *fsdata =NULL ; -if (flags &AOP_FLAG_CONT_EXPAND && - (pos & (inode->i_sb->s_blocksize -1 )) ==0 ) { - pos ++; - *fsdata = (void *)(unsigned long )flags; - } - index = pos >>PAGE_SHIFT ; page =grab_cache_page_write_begin (mapping, index, flags);if (!page)
@@ -2894,9 +2887,6 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,unsigned start;bool locked = false; -if ((unsigned long )fsdata &AOP_FLAG_CONT_EXPAND ) - pos ++; -reiserfs_wait_on_write_block (inode->i_sb);if (reiserfs_transaction_running (inode->i_sb)) th = current->journal_info;
@@ -3278,6 +3268,32 @@ static ssize_t reiserfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)return ret; } +int cont_expand (struct inode *inode,loff_t pos) +{ +void *fsdata; +struct page *page; +int err; + + err =inode_newsize_ok (inode, pos); +if (err) + goto out; +if ((pos & (inode->i_sb->s_blocksize -1 )) ==0 ) + pos++; + + err =reiserfs_write_begin (NULL , inode->i_mapping, pos,0 ,0 , + &page, &fsdata); +if (err) + goto out; + + err =reiserfs_write_end (NULL , inode->i_mapping, pos,0 ,0 , page, fsdata); +if (err) + goto out; + +out: +return err; + +} +int reiserfs_setattr (struct dentry *dentry,struct iattr *attr) {struct inode *inode =d_inode (dentry);
@@ -3313,7 +3329,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)/* fill in hole pointers in the expanding truncate case. */ if (attr->ia_size > inode->i_size) { - error =generic_cont_expand_simple (inode, attr->ia_size); + error =cont_expand (inode, attr->ia_size);if (REISERFS_I (inode)->i_prealloc_count >0 ) {int err;struct reiserfs_transaction_handle th;
include/linux/fs.h +0 -2
@@ -259,8 +259,6 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; -#define AOP_FLAG_CONT_EXPAND 0x0001/* called from cont_expand */ -/* * oh the beauties of C type declarations. */
Signature · 1 line
2.16.1
Matthew Wilcox
maintainerRe: [PATCH 09/10] reiserfs: cont_expand() to eliminate AOP_FLAG_CONT_EXPAND
include/linux/fs.h enum positive_aop_returns { · line 264
Quoted 10 lines · Goldwyn Rodrigues
+++
b/include/linux/fs.hinclude/linux/fs.h +0
-2@@ -259,8 +259,6 @@ enum positive_aop_returns { AOP_TRUNCATED_PAGE = 0x80001, }; -#define AOP_FLAG_CONT_EXPAND 0x0001/* called from cont_expand */ -/* * oh the beauties of C type declarations. */
This hunk needs to be part of patch 10, or you'll hit a bisection problem (fs/buffer.c still uses it).
PATCH 10/10 fs: Remove flags parameter from aops->write_begin()
In reply to Goldwyn RodriguesFrom: Goldwyn Rodrigues <[email protected]>
--- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- drivers/staging/lustre/lustre/llite/rw26.c | 5 ++--- fs/9p/vfs_addr.c | 4 ++-- fs/adfs/inode.c | 4 ++-- fs/affs/file.c | 10 +++++----- fs/afs/internal.h | 2 +- fs/afs/write.c | 4 ++-- fs/block_dev.c | 4 ++-- fs/buffer.c | 18 +++++++++--------- fs/ceph/addr.c | 4 ++-- fs/cifs/file.c | 4 ++-- fs/ecryptfs/mmap.c | 4 ++-- fs/exofs/inode.c | 5 ++--- fs/ext2/inode.c | 4 ++-- fs/ext4/ext4.h | 2 -- fs/ext4/inline.c | 18 ++++++------------ fs/ext4/inode.c | 18 +++++++++--------- fs/ext4/move_extent.c | 4 ++-- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 2 +- fs/f2fs/super.c | 2 +- fs/fat/inode.c | 4 ++-- fs/fuse/file.c | 6 +++--- fs/gfs2/aops.c | 4 ++-- fs/hfs/extent.c | 2 +- fs/hfs/inode.c | 4 ++-- fs/hfsplus/extents.c | 2 +- fs/hfsplus/inode.c | 4 ++-- fs/hostfs/hostfs_kern.c | 4 ++-- fs/hpfs/file.c | 4 ++-- fs/hugetlbfs/inode.c | 2 +- fs/iomap.c | 2 +- fs/jffs2/file.c | 6 +++--- fs/jfs/inode.c | 4 ++-- fs/libfs.c | 4 ++-- fs/minix/inode.c | 4 ++-- fs/namei.c | 2 +- fs/nfs/file.c | 4 ++-- fs/nilfs2/recovery.c | 2 +- fs/ocfs2/aops.c | 2 +- fs/omfs/file.c | 4 ++-- fs/reiserfs/inode.c | 6 +++--- fs/sysv/itree.c | 4 ++-- fs/ubifs/file.c | 11 +++++------ fs/udf/file.c | 4 ++-- fs/udf/inode.c | 4 ++-- fs/ufs/inode.c | 4 ++-- include/linux/buffer_head.h | 6 +++--- include/linux/fs.h | 6 +++--- include/linux/pagemap.h | 2 +- include/trace/events/ext4.h | 21 ++++++++------------- include/trace/events/f2fs.h | 12 ++++-------- mm/filemap.c | 10 ++++------ mm/shmem.c | 2 +- 54 files changed, 133 insertions(+), 155 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -2797,7 +2797,7 @@ i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj, len = remain; err =pagecache_write_begin (obj->base.filp, mapping, - offset, len,0 , + offset, len, &page, &data);if (err <0 )return err;
@@ -5612,7 +5612,7 @@ i915_gem_object_create_from_data(struct drm_i915_private *dev_priv,void *pgdata, *vaddr; err =pagecache_write_begin (file, file->f_mapping, - offset, len,0 , + offset, len, &page, &pgdata);if (err <0 ) goto fail;
drivers/staging/lustre/lustre/llite/rw26.c +2 -3
@@ -439,7 +439,7 @@ static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io, }static int ll_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned int len,unsigned int flags, +loff_t pos,unsigned int len,struct page **pagep,void **fsdata) {struct ll_cl_context *lcc;
@@ -489,8 +489,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, goto out;if (!vmpage) { - vmpage =grab_cache_page_write_begin (mapping, index, - flags); + vmpage =grab_cache_page_write_begin (mapping, index);if (!vmpage) { result = -ENOMEM ; goto out;
fs/9p/vfs_addr.c +2 -2
@@ -266,7 +266,7 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }static int v9fs_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int retval =0 ;
@@ -280,7 +280,7 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping, v9inode =V9FS_I (inode); start: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page) { retval = -ENOMEM ; goto out;
fs/adfs/inode.c +2 -2
@@ -54,13 +54,13 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to) }static int adfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, adfs_get_block, &ADFS_I (mapping->host)->mmu_private);if (unlikely (ret))
fs/affs/file.c +5 -5
@@ -413,13 +413,13 @@ affs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }static int affs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, affs_get_block, &AFFS_I (mapping->host)->mmu_private);if (unlikely (ret))
@@ -629,7 +629,7 @@ affs_readpage_ofs(struct file *file, struct page *page) }static int affs_write_begin_ofs (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -649,7 +649,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping } index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
@@ -858,7 +858,7 @@ affs_truncate(struct inode *inode)loff_t isize = inode->i_size;int res; - res = mapping->a_ops->write_begin (NULL , mapping, isize,0 ,0 , &page, &fsdata); + res = mapping->a_ops->write_begin (NULL , mapping, isize,0 , &page, &fsdata);if (!res) res = mapping->a_ops->write_end (NULL , mapping, isize,0 ,0 , page, fsdata);else
fs/afs/internal.h +1 -1
@@ -938,7 +938,7 @@ extern int afs_check_volume_status(struct afs_volume *, struct key *);*/ extern int afs_set_page_dirty (struct page *);extern int afs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); extern int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
fs/afs/write.c +2 -2
@@ -68,7 +68,7 @@ static int afs_fill_page(struct afs_vnode *vnode, struct key *key,* prepare to perform part of a write to a page */ int afs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct afs_vnode *vnode =AFS_FS_I (file_inode (file));
@@ -88,7 +88,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping,*/ BUILD_BUG_ON (PAGE_SIZE >32768 &&sizeof (page->private) <8 ); - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
fs/block_dev.c +2 -2
@@ -578,10 +578,10 @@ static int blkdev_readpages(struct file *file, struct address_space *mapping, }static int blkdev_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) { -return block_write_begin (mapping, pos, len, flags, pagep, +return block_write_begin (mapping, pos, len, pagep, blkdev_get_block); }
fs/buffer.c +9 -9
@@ -2082,13 +2082,13 @@ static int __block_commit_write(struct inode *inode, struct page *page,* The filesystem needs to handle block truncation upon failure. */ int block_write_begin (struct address_space *mapping,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,get_block_t *get_block) +struct page **pagep,get_block_t *get_block) {pgoff_t index = pos >>PAGE_SHIFT ;struct page *page;int status; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
@@ -2334,7 +2334,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size) goto out; err =pagecache_write_begin (NULL , mapping, size,0 , -AOP_FLAG_CONT_EXPAND , &page, &fsdata); + &page, &fsdata);if (err) goto out;
@@ -2369,7 +2369,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len =PAGE_SIZE - zerofrom; - err =pagecache_write_begin (file, mapping, curpos, len,0 , + err =pagecache_write_begin (file, mapping, curpos, len, &page, &fsdata);if (err) goto out;
@@ -2402,7 +2402,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping, } len = offset - zerofrom; - err =pagecache_write_begin (file, mapping, curpos, len,0 , + err =pagecache_write_begin (file, mapping, curpos, len, &page, &fsdata);if (err) goto out;
@@ -2423,7 +2423,7 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,* We may have to extend the file. */ int cont_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata,get_block_t *get_block,loff_t *bytes) {
@@ -2442,7 +2442,7 @@ int cont_write_begin(struct file *file, struct address_space *mapping, (*bytes)++; } -return block_write_begin (mapping, pos, len, flags, pagep, get_block); +return block_write_begin (mapping, pos, len, pagep, get_block); }EXPORT_SYMBOL (cont_write_begin);
@@ -2551,7 +2551,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head)* The filesystem needs to handle block truncation upon failure. */ int nobh_write_begin (struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata,get_block_t *get_block) {
@@ -2573,7 +2573,7 @@ int nobh_write_begin(struct address_space *mapping, from = pos & (PAGE_SIZE -1 ); to = from + len; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/ceph/addr.c +2 -2
@@ -1322,7 +1322,7 @@ static int ceph_update_writeable_page(struct file *file,* clean, or already dirty within the same snap context. */ static int ceph_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode =file_inode (file);
@@ -1332,7 +1332,7 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, do { /* get a page */ - page = grab_cache_page_write_begin(mapping, index, 0); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM;
fs/cifs/file.c +2 -2
@@ -3944,7 +3944,7 @@ bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) }static int cifs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int oncethru =0 ;
@@ -3958,7 +3958,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,cifs_dbg (FYI ,"write_begin from %lld len %d\n" , (long long )pos, len); start: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page) { rc = -ENOMEM ; goto out;
fs/ecryptfs/mmap.c +2 -2
@@ -277,7 +277,7 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to)*/ static int ecryptfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ;
@@ -285,7 +285,7 @@ static int ecryptfs_write_begin(struct file *file,loff_t prev_page_end_size;int rc =0 ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/exofs/inode.c +2 -3
@@ -862,7 +862,7 @@ static void _write_failed(struct inode *inode, loff_t to) }int exofs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret =0 ;
@@ -870,8 +870,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, page = *pagep;if (page ==NULL ) { - page =grab_cache_page_write_begin (mapping, pos >>PAGE_SHIFT , - flags); + page =grab_cache_page_write_begin (mapping, pos >>PAGE_SHIFT );if (!page) {EXOFS_DBGMSG ("grab_cache_page_write_begin failed\n" );return -ENOMEM ;
fs/ext2/inode.c +2 -2
@@ -881,12 +881,12 @@ ext2_readpages(struct file *file, struct address_space *mapping,static int ext2_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, + ret =block_write_begin (mapping, pos, len, pagep, ext2_get_block);if (ret <0 )ext2_write_failed (mapping, pos + len);
fs/ext4/ext4.h +0 -2
@@ -2954,7 +2954,6 @@ extern int ext4_readpage_inline(struct inode *inode, struct page *page);extern int ext4_try_to_write_inline_data (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep); extern int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
@@ -2967,7 +2966,6 @@ ext4_journalled_write_inline_data(struct inode *inode,extern int ext4_da_write_inline_data_begin (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,void **fsdata); extern int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,
fs/ext4/inline.c +6 -12
@@ -517,8 +517,7 @@ int ext4_readpage_inline(struct inode *inode, struct page *page) }static int ext4_convert_inline_data_to_extent (struct address_space *mapping, -struct inode *inode, -unsigned flags) +struct inode *inode) {int ret, needed_blocks, no_expand;handle_t *handle =NULL ;
@@ -555,7 +554,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,* started */ nofs_flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );memalloc_nofs_restore (nofs_flags);
@@ -643,7 +642,6 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,int ext4_try_to_write_inline_data (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep) {int ret;
@@ -684,7 +682,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, nofs_flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );memalloc_nofs_restore (nofs_flags);if (!page) {
@@ -717,8 +715,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,brelse (iloc.bh);return ret; convert: -return ext4_convert_inline_data_to_extent (mapping, - inode, flags); +return ext4_convert_inline_data_to_extent (mapping, inode); } int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
@@ -793,13 +790,12 @@ ext4_journalled_write_inline_data(struct inode *inode,*/ static int ext4_da_convert_inline_data_to_extent (struct address_space *mapping,struct inode *inode, -unsigned flags,void **fsdata) {int ret =0 , inline_size;struct page *page; - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );if (!page)return -ENOMEM ;
@@ -852,7 +848,6 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,int ext4_da_write_inline_data_begin (struct address_space *mapping,struct inode *inode,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,void **fsdata) {
@@ -886,7 +881,6 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,int nofs_flags =memalloc_nofs_save (); ret =ext4_da_convert_inline_data_to_extent (mapping, inode, - flags, fsdata);memalloc_nofs_restore (nofs_flags);ext4_journal_stop (handle);
@@ -897,7 +891,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, } - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );if (!page) { ret = -ENOMEM ; goto out_journal;
fs/ext4/inode.c +9 -9
@@ -1239,7 +1239,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,#endif static int ext4_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -1253,7 +1253,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,if (unlikely (ext4_forced_shutdown (EXT4_SB (inode->i_sb))))return -EIO ; -trace_ext4_write_begin (inode, pos, len, flags); +trace_ext4_write_begin (inode, pos, len);/* * Reserve one block more for addition to orphan list in case * we allocate blocks but write fails for some reason
@@ -1265,7 +1265,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { ret =ext4_try_to_write_inline_data (mapping, inode, pos, len, - flags, pagep); + pagep);if (ret <0 )return ret;if (ret ==1 )
@@ -1280,7 +1280,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,* the page (if needed) without using GFP_NOFS. */ retry_grab: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;unlock_page (page);
@@ -3003,7 +3003,7 @@ static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len) }static int ext4_da_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret, retries =0 ;
@@ -3021,14 +3021,14 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, S_ISLNK(inode->i_mode)) { *fsdata = (void *)FALL_BACK_TO_NONDELALLOC ;return ext4_write_begin (file, mapping, pos, - len, flags, pagep, fsdata); + len, pagep, fsdata); } *fsdata = (void *)0 ; -trace_ext4_da_write_begin (inode, pos, len, flags); +trace_ext4_da_write_begin (inode, pos, len);if (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA )) { ret =ext4_da_write_inline_data_begin (mapping, inode, - pos, len, flags, + pos, len, pagep, fsdata);if (ret <0 )return ret;
@@ -3044,7 +3044,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,* the page (if needed) without using GFP_NOFS. */ retry_grab: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;unlock_page (page);
fs/ext4/move_extent.c +2 -2
@@ -142,13 +142,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, mapping[1 ] = inode1->i_mapping; } - page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1,0 ); + page[0 ] =grab_cache_page_write_begin (mapping[0 ], index1);if (!page[0 ]) {memalloc_nofs_restore (nofs_fl);return -ENOMEM ; } - page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2,0 ); + page[1 ] =grab_cache_page_write_begin (mapping[1 ], index2);memalloc_nofs_restore (nofs_fl);if (!page[1 ]) {unlock_page (page[0 ]);
fs/f2fs/data.c +2 -2
@@ -2134,7 +2134,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, }static int f2fs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -2145,7 +2145,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,block_t blkaddr =NULL_ADDR ;int err =0 ; -trace_f2fs_write_begin (inode, pos, len, flags); +trace_f2fs_write_begin (inode, pos, len);if (f2fs_is_atomic_file (inode) && !available_free_memory (sbi,INMEM_PAGES )) {
fs/f2fs/f2fs.h +1 -1
@@ -1923,7 +1923,7 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,return grab_cache_page (mapping, index); nofs_flags =memalloc_nofs_save (); - pg =grab_cache_page_write_begin (mapping, index,0 ); + pg =grab_cache_page_write_begin (mapping, index);memalloc_nofs_restore (nofs_flags);return pg; }
fs/f2fs/super.c +1 -1
@@ -1507,7 +1507,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, tocopy = min_t(unsigned long, sb->s_blocksize - offset, towrite); retry: - err = a_ops->write_begin (NULL , mapping, off, tocopy,0 , + err = a_ops->write_begin (NULL , mapping, off, tocopy, &page,NULL );if (unlikely (err)) {if (err == -ENOMEM ) {
fs/fat/inode.c +2 -2
@@ -214,13 +214,13 @@ static void fat_write_failed(struct address_space *mapping, loff_t to) }static int fat_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int err; *pagep =NULL ; - err =cont_write_begin (file, mapping, pos, len, flags, + err =cont_write_begin (file, mapping, pos, len, pagep, fsdata, fat_get_block, &MSDOS_I (mapping->host)->mmu_private);if (err <0 )
fs/fuse/file.c +3 -3
@@ -1063,7 +1063,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,break ; err = -ENOMEM ; - page =grab_cache_page_write_begin (mapping, index,0 ); + page =grab_cache_page_write_begin (mapping, index);if (!page)break ;
@@ -1940,7 +1940,7 @@ static int fuse_writepages(struct address_space *mapping,* but how to implement it without killing performance need more thinking. */ static int fuse_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ;
@@ -1951,7 +1951,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,WARN_ON (!fc->writeback_cache); - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page) goto error;
fs/gfs2/aops.c +2 -2
@@ -659,7 +659,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,*/ static int gfs2_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct gfs2_inode *ip =GFS2_I (mapping->host);
@@ -722,7 +722,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, error = -ENOMEM ; nofs_flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);memalloc_nofs_restore (nofs_flags); *pagep = page;if (unlikely (!page))
fs/hfs/extent.c +1 -1
@@ -485,7 +485,7 @@ 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 ,0 , + res =pagecache_write_begin (NULL , mapping, size+1 ,0 , &page, &fsdata);if (!res) { res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
fs/hfs/inode.c +2 -2
@@ -49,13 +49,13 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to) }static int hfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hfs_get_block, &HFS_I (mapping->host)->phys_size);if (unlikely (ret))
fs/hfsplus/extents.c +1 -1
@@ -546,7 +546,7 @@ void hfsplus_file_truncate(struct inode *inode)void *fsdata;loff_t size = inode->i_size; - res =pagecache_write_begin (NULL , mapping, size,0 ,0 , + res =pagecache_write_begin (NULL , mapping, size,0 , &page, &fsdata);if (res)return ;
fs/hfsplus/inode.c +2 -2
@@ -44,13 +44,13 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to) }static int hfsplus_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hfsplus_get_block, &HFSPLUS_I (mapping->host)->phys_size);if (unlikely (ret))
fs/hostfs/hostfs_kern.c +2 -2
@@ -468,12 +468,12 @@ static int hostfs_readpage(struct file *file, struct page *page) }static int hostfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {pgoff_t index = pos >>PAGE_SHIFT ; - *pagep =grab_cache_page_write_begin (mapping, index, flags); + *pagep =grab_cache_page_write_begin (mapping, index);if (!*pagep)return -ENOMEM ;return 0 ;
fs/hpfs/file.c +2 -2
@@ -152,13 +152,13 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to) }static int hpfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; *pagep =NULL ; - ret =cont_write_begin (file, mapping, pos, len, flags, pagep, fsdata, + ret =cont_write_begin (file, mapping, pos, len, pagep, fsdata, hpfs_get_block, &hpfs_i (mapping->host)->mmu_private);if (unlikely (ret))
fs/hugetlbfs/inode.c +1 -1
@@ -302,7 +302,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)static int hugetlbfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {return -EINVAL ;
fs/iomap.c +1 -1
@@ -124,7 +124,7 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len,return -EINTR ; nofs_flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (inode->i_mapping, index,0 ); + page =grab_cache_page_write_begin (inode->i_mapping, index);memalloc_nofs_restore (nofs_flags);if (!page)return -ENOMEM ;
fs/jffs2/file.c +3 -3
@@ -25,7 +25,7 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *pg, void *fsdata);static int jffs2_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata);static int jffs2_readpage (struct file *filp,struct page *pg);
@@ -129,7 +129,7 @@ static int jffs2_readpage (struct file *filp, struct page *pg) }static int jffs2_write_begin (struct file *filp,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct page *pg;
@@ -139,7 +139,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,uint32_t pageofs = index <<PAGE_SHIFT ;int ret =0 ; - pg =grab_cache_page_write_begin (mapping, index, flags); + pg =grab_cache_page_write_begin (mapping, index);if (!pg)return -ENOMEM ; *pagep = pg;
fs/jfs/inode.c +2 -2
@@ -314,12 +314,12 @@ static void jfs_write_failed(struct address_space *mapping, loff_t to) }static int jfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =nobh_write_begin (mapping, pos, len, flags, pagep, fsdata, + ret =nobh_write_begin (mapping, pos, len, pagep, fsdata, jfs_get_block);if (unlikely (ret))jfs_write_failed (mapping, pos + len);
fs/libfs.c +2 -2
@@ -424,7 +424,7 @@ int simple_readpage(struct file *file, struct page *page)EXPORT_SYMBOL (simple_readpage);int simple_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct page *page;
@@ -432,7 +432,7 @@ int simple_write_begin(struct file *file, struct address_space *mapping, index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ;
fs/minix/inode.c +2 -2
@@ -407,12 +407,12 @@ static void minix_write_failed(struct address_space *mapping, loff_t to) }static int minix_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, + ret =block_write_begin (mapping, pos, len, pagep, minix_get_block);if (unlikely (ret))minix_write_failed (mapping, pos + len);
fs/namei.c +1 -1
@@ -4802,7 +4802,7 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) retry: err =pagecache_write_begin (NULL , mapping,0 , len-1 , - flags, &page, &fsdata); + &page, &fsdata);if (err) goto fail;
fs/nfs/file.c +2 -2
@@ -322,7 +322,7 @@ static int nfs_want_read_modify_write(struct file *file, struct page *page,* increment the page use counts until he is done with the page. */ static int nfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
@@ -334,7 +334,7 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping, file, mapping->host->i_ino, len, (long long) pos); start: - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
fs/nilfs2/recovery.c +1 -1
@@ -520,7 +520,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, pos = rb->blkoff << inode->i_blkbits; err =block_write_begin (inode->i_mapping, pos, blocksize, -0 , &page, nilfs_get_block); + &page, nilfs_get_block);if (unlikely (err)) {loff_t isize = inode->i_size;
fs/ocfs2/aops.c +1 -1
@@ -1906,7 +1906,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, }static int ocfs2_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret;
fs/omfs/file.c +2 -2
@@ -317,12 +317,12 @@ static void omfs_write_failed(struct address_space *mapping, loff_t to) }static int omfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, + ret =block_write_begin (mapping, pos, len, pagep, omfs_get_block);if (unlikely (ret))omfs_write_failed (mapping, pos + len);
fs/reiserfs/inode.c +3 -3
@@ -2751,7 +2751,7 @@ static void reiserfs_truncate_failed_write(struct inode *inode)static int reiserfs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode;
@@ -2762,7 +2762,7 @@ static int reiserfs_write_begin(struct file *file, inode = mapping->host; index = pos >>PAGE_SHIFT ; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (!page)return -ENOMEM ; *pagep = page;
@@ -3280,7 +3280,7 @@ int cont_expand(struct inode *inode, loff_t pos)if ((pos & (inode->i_sb->s_blocksize -1 )) ==0 ) pos++; - err =reiserfs_write_begin (NULL , inode->i_mapping, pos,0 ,0 , + err =reiserfs_write_begin (NULL , inode->i_mapping, pos,0 , &page, &fsdata);if (err) goto out;
fs/sysv/itree.c +2 -2
@@ -477,12 +477,12 @@ static void sysv_write_failed(struct address_space *mapping, loff_t to) }static int sysv_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, get_block); + ret =block_write_begin (mapping, pos, len, pagep, get_block);if (unlikely (ret))sysv_write_failed (mapping, pos + len);
fs/ubifs/file.c +5 -6
@@ -226,8 +226,7 @@ static void release_existing_page_budget(struct ubifs_info *c) }static int write_begin_slow (struct address_space *mapping, -loff_t pos,unsigned len,struct page **pagep, -unsigned flags) +loff_t pos,unsigned len,struct page **pagep) {struct inode *inode = mapping->host;struct ubifs_info *c = inode->i_sb->s_fs_info;
@@ -255,7 +254,7 @@ static int write_begin_slow(struct address_space *mapping,if (unlikely (err))return err; - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (unlikely (!page)) {ubifs_release_budget (c, &req);return -ENOMEM ;
@@ -430,7 +429,7 @@ static int allocate_budget(struct ubifs_info *c, struct page *page,* without forcing write-back. The slow path does not make this assumption. */ static int ubifs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
@@ -448,7 +447,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,return -EROFS ;/* Try out the fast-path part first */ - page =grab_cache_page_write_begin (mapping, index, flags); + page =grab_cache_page_write_begin (mapping, index);if (unlikely (!page))return -ENOMEM ;
@@ -504,7 +503,7 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,unlock_page (page);put_page (page); -return write_begin_slow (mapping, pos, len, pagep, flags); +return write_begin_slow (mapping, pos, len, pagep); }/*
fs/udf/file.c +2 -2
@@ -88,14 +88,14 @@ static int udf_adinicb_writepage(struct page *page,static int udf_adinicb_write_begin (struct file *file,struct address_space *mapping,loff_t pos, -unsigned len,unsigned flags,struct page **pagep, +unsigned len,struct page **pagep,void **fsdata) {struct page *page;if (WARN_ON_ONCE (pos >=PAGE_SIZE ))return -EIO ; - page =grab_cache_page_write_begin (mapping,0 , flags); + page =grab_cache_page_write_begin (mapping,0 );if (!page)return -ENOMEM ; *pagep = page;
fs/udf/inode.c +2 -2
@@ -195,12 +195,12 @@ static int udf_readpages(struct file *file, struct address_space *mapping, }static int udf_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, udf_get_block); + ret =block_write_begin (mapping, pos, len, pagep, udf_get_block);if (unlikely (ret))udf_write_failed (mapping, pos + len);return ret;
fs/ufs/inode.c +2 -2
@@ -495,12 +495,12 @@ static void ufs_write_failed(struct address_space *mapping, loff_t to) }static int ufs_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {int ret; - ret =block_write_begin (mapping, pos, len, flags, pagep, + ret =block_write_begin (mapping, pos, len, pagep, ufs_getfrag_block);if (unlikely (ret))ufs_write_failed (mapping, pos + len);
include/linux/buffer_head.h +3 -3
@@ -225,7 +225,7 @@ int block_read_full_page(struct page*, get_block_t*);int block_is_partially_uptodate (struct page *page,unsigned long from,unsigned long count);int block_write_begin (struct address_space *mapping,loff_t pos,unsigned len, -unsigned flags,struct page **pagep,get_block_t *get_block); +struct page **pagep,get_block_t *get_block);int __block_write_begin (struct page *page,loff_t pos,unsigned len,get_block_t *get_block); int block_write_end(struct file *, struct address_space *,
@@ -237,7 +237,7 @@ int generic_write_end(struct file *, struct address_space *,void page_zero_new_buffers (struct page *page,unsigned from,unsigned to);void clean_page_buffers (struct page *page);int cont_write_begin (struct file *,struct address_space *,loff_t , -unsigned ,unsigned ,struct page **,void **, +unsigned ,struct page **,void **,get_block_t *,loff_t *);int generic_cont_expand_simple (struct inode *inode,loff_t size);int block_commit_write (struct page *page,unsigned from,unsigned to);
@@ -257,7 +257,7 @@ static inline int block_page_mkwrite_return(int err) }sector_t generic_block_bmap (struct address_space *,sector_t ,get_block_t *);int block_truncate_page (struct address_space *,loff_t ,get_block_t *); -int nobh_write_begin (struct address_space *,loff_t ,unsigned ,unsigned , +int nobh_write_begin (struct address_space *,loff_t ,unsigned ,struct page **,void **,get_block_t *); int nobh_write_end(struct file *, struct address_space *, loff_t, unsigned, unsigned,
include/linux/fs.h +3 -3
@@ -337,7 +337,7 @@ struct address_space_operations { struct list_head *pages, unsigned nr_pages);int (*write_begin)(struct file *,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); int (*write_end)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
@@ -376,7 +376,7 @@ extern const struct address_space_operations empty_aops;* to write into the pagecache. */ int pagecache_write_begin (struct file *,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); int pagecache_write_end(struct file *, struct address_space *mapping,
@@ -3127,7 +3127,7 @@ extern int noop_fsync(struct file *, loff_t, loff_t, int);extern int simple_empty (struct dentry *);extern int simple_readpage (struct file *file,struct page *page);extern int simple_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata); extern int simple_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
include/linux/pagemap.h +1 -1
@@ -377,7 +377,7 @@ unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, struct page **entries, pgoff_t *indices);struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index,unsigned flags); +pgoff_t index);/* * Returns locked page at given index in given cache, creating it if needed.
include/trace/events/ext4.h +8 -13
@@ -272,17 +272,15 @@ TRACE_EVENT(ext4_begin_ordered_truncate, DECLARE_EVENT_CLASS(ext4__write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field( dev_t, dev ) __field( ino_t, ino ) __field( loff_t, pos ) __field( unsigned int, len ) - __field( unsigned int, flags ) ), TP_fast_assign(
@@ -290,29 +288,26 @@ DECLARE_EVENT_CLASS(ext4__write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), -TP_printk ("dev %d,%d ino %lu pos %lld len %u flags %u" , +TP_printk ("dev %d,%d ino %lu pos %lld len %u" ,MAJOR (__entry->dev),MINOR (__entry->dev), (unsigned long ) __entry->ino, - __entry->pos, __entry->len, __entry->flags) + __entry->pos, __entry->len) );DEFINE_EVENT (ext4__write_begin, ext4_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), -TP_ARGS (inode, pos, len, flags) +TP_ARGS (inode, pos, len) );DEFINE_EVENT (ext4__write_begin, ext4_da_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), -TP_ARGS (inode, pos, len, flags) +TP_ARGS (inode, pos, len) ); DECLARE_EVENT_CLASS(ext4__write_end,
include/trace/events/f2fs.h +4 -8
@@ -1090,17 +1090,15 @@ DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio, TRACE_EVENT(f2fs_write_begin, - TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, - unsigned int flags), + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), - TP_ARGS(inode, pos, len, flags), + TP_ARGS(inode, pos, len), TP_STRUCT__entry( __field(dev_t, dev) __field(ino_t, ino) __field(loff_t, pos) __field(unsigned int, len) - __field(unsigned int, flags) ), TP_fast_assign(
@@ -1108,14 +1106,12 @@ TRACE_EVENT(f2fs_write_begin, __entry->ino = inode->i_ino; __entry->pos = pos; __entry->len = len; - __entry->flags = flags; ), -TP_printk ("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u" , +TP_printk ("dev = (%d,%d), ino = %lu, pos = %llu, len = %u" ,show_dev_ino (__entry), (unsigned long long )__entry->pos, - __entry->len, - __entry->flags) + __entry->len) ); TRACE_EVENT(f2fs_write_end,
mm/filemap.c +4 -6
@@ -2974,13 +2974,12 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)EXPORT_SYMBOL (generic_write_checks);int pagecache_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {const struct address_space_operations *aops = mapping->a_ops; -return aops->write_begin (file, mapping, pos, len, flags, - pagep, fsdata); +return aops->write_begin (file, mapping, pos, len, pagep, fsdata); }EXPORT_SYMBOL (pagecache_write_begin);
@@ -3077,7 +3076,7 @@ EXPORT_SYMBOL(generic_file_direct_write);* page. This function is specifically for buffered writes. */ struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index,unsigned flags) +pgoff_t index) {struct page *page;
@@ -3097,7 +3096,6 @@ ssize_t generic_perform_write(struct file *file,const struct address_space_operations *a_ops = mapping->a_ops;long status =0 ;ssize_t written =0 ; -unsigned int flags =0 ; do { struct page *page;
@@ -3131,7 +3129,7 @@ ssize_t generic_perform_write(struct file *file,break ; } - status = a_ops->write_begin (file, mapping, pos, bytes, flags, + status = a_ops->write_begin (file, mapping, pos, bytes, &page, &fsdata);if (unlikely (status <0 ))break ;
mm/shmem.c +1 -1
@@ -2352,7 +2352,7 @@ static int shmem_initxattrs(struct inode *, const struct xattr *, void *);static int shmem_write_begin (struct file *file,struct address_space *mapping, -loff_t pos,unsigned len,unsigned flags, +loff_t pos,unsigned len,struct page **pagep,void **fsdata) {struct inode *inode = mapping->host;
Signature · 1 line
2.16.1