lkml.org 
[lkml]   [2022]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@infradead.org>

\
 
 \ /
  Last update: 2022-10-14 05:24    [W:0.032 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site