Re: [PATCH 1/4] mm: Introduce and use page_cache_empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 04, 2020 at 05:17:52PM +0100, Matthew Wilcox (Oracle) wrote:
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 484a36185bb5..a474a92a2a72 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -18,6 +18,11 @@
>  
>  struct pagevec;
>  
> +static inline bool page_cache_empty(struct address_space *mapping)
> +{
> +	return xa_empty(&mapping->i_pages);

What about something like

	bool empty = xa_empty(&mapping->i_pages);
	VM_BUG_ON(empty && mapping->nrpages);
	return empty;

?

> +}
> +
>  /*
>   * Bits in mapping->flags.
>   */

-- 
 Kirill A. Shutemov




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux