All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shiyang Ruan <ruansy.fnst@fujitsu.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <linux-xfs@vger.kernel.org>, <nvdimm@lists.linux.dev>,
	<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>,
	<djwong@kernel.org>, <david@fromorbit.com>,
	<dan.j.williams@intel.com>, <hch@infradead.org>,
	<jane.chu@oracle.com>, <akpm@linux-foundation.org>
Subject: Re: [PATCH v10 2/3] fs: introduce super_drop_pagecache()
Date: Mon, 20 Feb 2023 17:39:20 +0800	[thread overview]
Message-ID: <55bfcacf-d034-46bc-37fb-16d2875f6d62@fujitsu.com> (raw)
In-Reply-To: <Y/EYiSTpjhvjxpUw@casper.infradead.org>



在 2023/2/19 2:27, Matthew Wilcox 写道:
> On Sat, Feb 18, 2023 at 09:16:43AM +0800, Shiyang Ruan wrote:
>> 在 2023/2/18 0:14, Matthew Wilcox 写道:
>>> On Fri, Feb 17, 2023 at 02:48:31PM +0000, Shiyang Ruan wrote:
>>>> -		invalidate_mapping_pages(inode->i_mapping, 0, -1);
>>>> -		iput(toput_inode);
>>>> -		toput_inode = inode;
>>>> -
>>>> -		cond_resched();
>>>> -		spin_lock(&sb->s_inode_list_lock);
>>>> -	}
>>>> -	spin_unlock(&sb->s_inode_list_lock);
>>>> -	iput(toput_inode);
>>>> +	super_drop_pagecache(sb, invalidate_inode_pages);
>>>
>>> I thought I explained last time that you can do this with
>>> invalidate_mapping_pages() / invalidate_inode_pages2_range() ?
>>> Then you don't need to introduce invalidate_inode_pages().
>>>
>>>> +void super_drop_pagecache(struct super_block *sb,
>>>> +	int (*invalidator)(struct address_space *))
>>>
>>> void super_drop_pagecache(struct super_block *sb,
>>> 		int (*invalidate)(struct address_space *, pgoff_t, pgoff_t))
>>>
>>>> +		invalidator(inode->i_mapping);
>>>
>>> 		invalidate(inode->i_mapping, 0, -1)
>>>
>>> ... then all the changes to mm/truncate.c and filemap.h go away.
>>
>> Yes, I tried as you suggested, but I found that they don't have same type of
>> return value.
>>
>> int invalidate_inode_pages2_range(struct address_space *mapping,
>> 				  pgoff_t start, pgoff_t end);
>>
>> unsigned long invalidate_mapping_pages(struct address_space *mapping,
>> 		pgoff_t start, pgoff_t end);
> 
> Oh, that's annoying.  Particularly annoying is that the return value
> for invalidate_mapping_pages() is used by fs/inode.c to account for
> the number of pages invalidate, and the return value for
> invalidate_inode_pages2_range() is used by several filesystems
> to know whether an error occurred.
> 
> Hm.  Shouldn't you be checking for an error from
> invalidate_inode_pages2_range()?  Seems like it can return -EBUSY for
> DAX entries.
> 
> With that in mind, the wrapper you actually want to exist is
> 
> static int invalidate_inode_pages_range(struct address_space *mapping,
> 				pgoff_t start, pgoff_t end)
> {
> 	invalidate_mapping_pages(mapping, start, end);
> 	return 0;
> }
> 
> Right?

So, I should introduce this wrapper in fs/xfs/xfs_notify_failure.c 
because it is the only one who calls this wrapper.  Ok, got it!


--
Thanks,
Ruan.

  reply	other threads:[~2023-02-20  9:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 14:48 [PATCH v10 0/3] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind Shiyang Ruan
2023-02-17 14:48 ` [PATCH v10 1/3] xfs: fix the calculation of length and end Shiyang Ruan
2023-02-17 14:48 ` [PATCH v10 2/3] fs: introduce super_drop_pagecache() Shiyang Ruan
2023-02-17 16:14   ` Matthew Wilcox
2023-02-18  1:16     ` Shiyang Ruan
2023-02-18 18:27       ` Matthew Wilcox
2023-02-20  9:39         ` Shiyang Ruan [this message]
2023-02-20  9:45           ` Shiyang Ruan
2023-02-20 21:25   ` Dave Chinner
2023-02-21  1:57     ` Shiyang Ruan
2023-02-26 23:50       ` Dave Chinner
2023-02-17 14:48 ` [PATCH v10 3/3] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind Shiyang Ruan
2023-02-27  0:07   ` Dave Chinner
2023-02-27 10:06     ` Shiyang Ruan
2023-03-21 10:59       ` Shiyang Ruan
2023-03-24  9:49         ` Shiyang Ruan

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=55bfcacf-d034-46bc-37fb-16d2875f6d62@fujitsu.com \
    --to=ruansy.fnst@fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=jane.chu@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.