RE: [PATCH 4/8] mm: cleanup add_to_page_cache_locked()

From: Kirill A. Shutemov
Date: Mon Jul 15 2013 - 09:52:50 EST


Kirill A. Shutemov wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
>
> The patch makes add_to_page_cache_locked() cleaner:
> - unindent most code of the function by inverting one condition;
> - streamline code no-error path;
> - move insert error path outside normal code path;
> - call radix_tree_preload_end() earlier;
>
> No functional changes.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> ---

...

> + spin_lock_irq(&mapping->tree_lock);
> + error = radix_tree_insert(&mapping->page_tree, offset, page);
> + radix_tree_preload_end();
> + if (unlikely(!error))
> + goto err_insert;

Nadav Shemer noticed mistake here. It should be 'if (unlikely(error))'.

I've missed this during becase it was fixed by other patch in my
thp-pagecache series.

Fixed patch is below. Retested with this patchset applied only.
Looks okay now.

Sorry for this.

---