From: Dave Chinner <david@fromorbit.com>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-fsdevel@vger.kernel.org, mhocko@kernel.org,
Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 06/10] fs: iomap use memalloc_nofs_* scope API
Date: Tue, 20 Feb 2018 09:30:53 +1100 [thread overview]
Message-ID: <20180219223053.GJ6778@dastard> (raw)
In-Reply-To: <20180219140230.5077-7-rgoldwyn@suse.de>
On Mon, Feb 19, 2018 at 08:02:26AM -0600, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> While we are at it, remove the flags parameter from iomap_write_begin()
> since we passed AOP_FLAG_NOFS to it.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
> fs/iomap.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index afd163586aa0..afaf6ffff34f 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -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);
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.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-02-19 22:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 14:02 [PATCH 00/10] Use the memalloc_nofs scope API Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 01/10] fs: buffer - Use memalloc_nofs API to allocate pages Goldwyn Rodrigues
2018-02-19 14:24 ` Michal Hocko
2018-02-19 14:02 ` [PATCH 02/10] fs: mpage use memalloc_nofs_save/restore while allocating bios Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 03/10] ext4: Use memalloc_nofs_* scope API Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 04/10] f2fs: " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 05/10] gfs2: " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 06/10] fs: iomap use " Goldwyn Rodrigues
2018-02-19 22:30 ` Dave Chinner [this message]
2018-02-20 9:05 ` Michal Hocko
2018-02-20 12:16 ` Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 07/10] fs: namei " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 08/10] fs: Eliminate AOP_FLAG_NOFS Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 09/10] reiserfs: cont_expand() to eliminate AOP_FLAG_CONT_EXPAND Goldwyn Rodrigues
2018-02-19 14:55 ` Matthew Wilcox
2018-02-19 14:02 ` [PATCH 10/10] fs: Remove flags parameter from aops->write_begin() Goldwyn Rodrigues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180219223053.GJ6778@dastard \
--to=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=rgoldwyn@suse.com \
--cc=rgoldwyn@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).