linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Don Dutile <ddutile@redhat.com>,
	Rafael Aquini <raquini@redhat.com>,
	Dave Chinner <david@fromorbit.com>,
	Mike Snitzer <snitzer@kernel.org>,
	ming.lei@redhat.com
Subject: Re: [PATCH] mm/madvise: set ra_pages as device max request size during ADV_POPULATE_READ
Date: Fri, 2 Feb 2024 12:48:28 +0800	[thread overview]
Message-ID: <Zbx0HDYfdneFRs9/@fedora> (raw)
In-Reply-To: <Zbxsawh-wlkQ5-8C@casper.infradead.org>

On Fri, Feb 02, 2024 at 04:15:39AM +0000, Matthew Wilcox wrote:
> On Fri, Feb 02, 2024 at 10:20:29AM +0800, Ming Lei wrote:
> > +static struct file *madvise_override_ra_win(struct file *f,
> > +		unsigned long start, unsigned long end,
> > +		unsigned int *old_ra_pages)
> > +{
> > +	unsigned int io_pages;
> > +
> > +	if (!f || !f->f_mapping || !f->f_mapping->host)
> > +		return NULL;
> 
> How can ->f_mapping be NULL?  How can f_mapping->host be NULL?

You are right, the two checks can be removed because both two won't
be NULL for opened file, and .f_ra is initialized with
f->f_mapping->host->i_mapping directly too. I will drop the checks
in next version.

BTW, looks the same check in madvise_remove() can removed too.

Thanks,
Ming



  reply	other threads:[~2024-02-02  4:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  2:20 Ming Lei
2024-02-02  4:15 ` Matthew Wilcox
2024-02-02  4:48   ` Ming Lei [this message]
2024-02-02  4:43 ` Mike Snitzer
2024-02-02 10:52   ` Ming Lei
2024-02-02 14:19     ` Mike Snitzer
2024-02-04 23:34 ` [PATCH] " Dave Chinner
2024-02-05  9:53   ` Ming Lei

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=Zbx0HDYfdneFRs9/@fedora \
    --to=ming.lei@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@fromorbit.com \
    --cc=david@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=raquini@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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