[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y0jWUSLY1aiVWDIb@casper.infradead.org>
Date: Fri, 14 Oct 2022 04:24:01 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "Vishal Moola (Oracle)" <vishal.moola@...il.com>
Cc: akpm@...ux-foundation.org, hughd@...gle.com,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] filemap: find_lock_entries() now updates start
offset
On Thu, Oct 13, 2022 at 03:57:07PM -0700, Vishal Moola (Oracle) wrote:
> Initially, find_lock_entries() was being passed in the start offset as a
> value. That left the calculation of the offset to the callers. This led
> to complexity in the callers trying to keep track of the index.
>
> Now find_lock_entires() takes in a pointer to the start offset and
s/entires/entries/
> updates the value to be directly after the last entry found. If no entry is
> found, the offset is not changed. This gets rid of multiple hacky
> calculations that kept track of the start offset.
> @@ -2120,8 +2120,17 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t start,
> put:
> folio_put(folio);
> }
> - rcu_read_unlock();
>
> + if (folio_batch_count(fbatch)) {
> + unsigned long nr = 1;
> + int idx = folio_batch_count(fbatch) - 1;
> +
> + folio = fbatch->folios[idx];
> + if (!xa_is_value(folio) && !folio_test_hugetlb(folio))
> + nr = folio_nr_pages(folio);
> + *start = indices[idx] + nr;
> + }
> + rcu_read_unlock();
> return folio_batch_count(fbatch);
Do we need to move the rcu_read_unlock()? Pretty sure we can do all
these calculations without it.
This all looks good. It's certainly more ergonomic to use.
Reviewed-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Powered by blists - more mailing lists