From: Jan Kara <jack@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: Piotr Balcer <piotr.balcer@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>,
linux-nvdimm@lists.01.org
Subject: Re: [PATCH] dax: Flush partial PMDs correctly
Date: Fri, 1 Mar 2019 14:49:54 +0100 [thread overview]
Message-ID: <20190301134954.GA31094@quack2.suse.cz> (raw)
In-Reply-To: <20190301042448.6868-1-willy@infradead.org>
On Thu 28-02-19 20:24:48, Matthew Wilcox wrote:
> The radix tree would rewind the index in an iterator to the lowest index
> of a multi-slot entry. The XArray iterators instead leave the index
> unchanged, but I overlooked that when converting DAX from the radix tree
> to the XArray. Adjust the index that we use for flushing to the start
> of the PMD range.
>
> Fixes: c1901cd33cf4 "page cache: Convert find_get_entries_tag to XArray"
> Reported-by: Piotr Balcer <piotr.balcer@intel.com>
> Tested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Matthew Wilcox <willy@infradead.org>
> ---
Thanks for the patch! One comment below:
> @@ -894,17 +893,18 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
> xas_unlock_irq(xas);
>
> /*
> - * Even if dax_writeback_mapping_range() was given a wbc->range_start
> - * in the middle of a PMD, the 'index' we are given will be aligned to
> - * the start index of the PMD, as will the pfn we pull from 'entry'.
> + * If dax_writeback_mapping_range() was given a wbc->range_start
> + * in the middle of a PMD, the 'index' we are given needs to be
> + * aligned to the start index of the PMD.
> * This allows us to flush for PMD_SIZE and not have to worry about
> * partial PMD writebacks.
> */
> pfn = dax_to_pfn(entry);
> - size = PAGE_SIZE << dax_entry_order(entry);
> + count = 1UL << dax_entry_order(entry);
> + index = xas->xa_index &~ (count - 1);
Hum, why do you compute 'index' here when you actually never use it? The
whole patch looks fishy since it is effectively a noop AFAICT...
Honza
>
> dax_entry_mkclean(mapping, xas->xa_index, pfn);
> - dax_flush(dax_dev, page_address(pfn_to_page(pfn)), size);
> + dax_flush(dax_dev, page_address(pfn_to_page(pfn)), count * PAGE_SIZE);
> /*
> * After we have flushed the cache, we can clear the dirty tag. There
> * cannot be new dirty data in the pfn after the flush has completed as
> @@ -917,8 +917,7 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
> xas_clear_mark(xas, PAGECACHE_TAG_DIRTY);
> dax_wake_entry(xas, entry, false);
>
> - trace_dax_writeback_one(mapping->host, xas->xa_index,
> - size >> PAGE_SHIFT);
> + trace_dax_writeback_one(mapping->host, xas->xa_index, count);
> return ret;
>
> put_unlocked:
> --
> 2.20.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2019-03-01 13:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 4:24 [PATCH] dax: Flush partial PMDs correctly Matthew Wilcox
2019-03-01 13:49 ` Jan Kara [this message]
2019-03-01 19:13 ` Matthew Wilcox
-- strict thread matches above, loose matches on Subject: below --
2019-03-01 19:12 Matthew Wilcox
2019-03-02 3:50 ` Dan Williams
2019-03-11 9:05 ` Jan Kara
2019-03-11 19:06 ` Dan Williams
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=20190301134954.GA31094@quack2.suse.cz \
--to=jack@suse.cz \
--cc=dan.j.williams@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=piotr.balcer@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).