[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161209120233.GA9876@quack2.suse.cz>
Date: Fri, 9 Dec 2016 13:02:33 +0100
From: Jan Kara <jack@...e.cz>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
linux-ext4@...r.kernel.org, linux-mm@...ck.org,
linux-nvdimm@...ts.01.org
Subject: Re: [PATCH 2/6] mm: Invalidate DAX radix tree entries only if
appropriate
Hi,
On Wed 30-11-16 09:08:41, Jan Kara wrote:
> > > +static int __dax_invalidate_mapping_entry(struct address_space *mapping,
> > > + pgoff_t index, bool trunc)
> > > +{
> > > + int ret = 0;
> > > + void *entry;
> > > + struct radix_tree_root *page_tree = &mapping->page_tree;
> > > +
> > > + spin_lock_irq(&mapping->tree_lock);
> > > + entry = get_unlocked_mapping_entry(mapping, index, NULL);
> > > + if (!entry || !radix_tree_exceptional_entry(entry))
> > > + goto out;
> > > + if (!trunc &&
> > > + (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
> > > + radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE)))
> > > + goto out;
> > > + radix_tree_delete(page_tree, index);
> >
> > You could use the new __radix_tree_replace() here and save a second
> > tree lookup.
>
> Hum, I'd need to return 'node' from get_unlocked_mapping_entry(). So
> probably I'll do it in a patch separate from this fix. But thanks for
> suggestion.
So I did this and quickly spotted a problem that when you use
__radix_tree_replace() to clear an entry, it will leave tags for that entry
set and that results in surprises. So I think I'll leave the code with
radix_tree_delete() for now.
It would probably make sense to make __radix_tree_replace() to clear tags
when we replace entry with NULL or at least WARN if some tags are set...
What do you think?
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists