[Ocfs2-devel] [PATCH 18/25] vfs: hide file range comparison	function
    Christoph Hellwig 
    hch at infradead.org
       
    Sun Oct 14 10:43:24 PDT 2018
    
    
  
> +static struct page *vfs_dedupe_get_page(struct inode *inode, loff_t offset)
> +{
> +	struct address_space *mapping;
> +	struct page *page;
> +	pgoff_t n;
> +
> +	n = offset >> PAGE_SHIFT;
> +	mapping = inode->i_mapping;
> +	page = read_mapping_page(mapping, n, NULL);
> +	if (IS_ERR(page))
> +		return page;
> +	if (!PageUptodate(page)) {
> +		put_page(page);
> +		return ERR_PTR(-EIO);
> +	}
> +	lock_page(page);
> +	return page;
> +}
Might be worth to clean ths up a bit while you are at it:
+static struct page *vfs_dedupe_get_page(struct inode *inode, loff_t offset)
{
	struct page *page;
	page = read_mapping_page(inode->i_mapping, offset >> PAGE_SHIFT, NULL);
	...
Otherwise looks fine:
Reviewed-by: Christoph Hellwig <hch at lst.de>
    
    
More information about the Ocfs2-devel
mailing list