Re: [PATCH] mm/madvise: set ra_pages as device max request size during ADV_POPULATE_READ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux