Re: [PATCH v8 06/10] iomap: Add page_write_end iomap hook

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

 



On Mon, Jun 04, 2018 at 09:31:19PM +0200, Andreas Gruenbacher wrote:
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -181,16 +181,22 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
>  
>  static int
>  iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
> -		unsigned copied, struct page *page, struct iomap *iomap)
> +		unsigned copied, struct page *page, struct iomap *iomap,
> +		const struct iomap_ops *ops)
>  {
> +	typeof(ops->page_write_end) page_write_end = ops->page_write_end;

Is the reason to use typeof is to avoid repeating the type of
page_write_end? As it's only for a temporary variable with 2 uses,
ops->page_write_end does not hurt readability nor is too much typing.

I would not recommend using typeof outside of the justified contexts
like macros or without a good reason.

>  	int ret;
>  
>  	if (iomap->type == IOMAP_INLINE) {
>  		iomap_write_inline_data(inode, page, iomap, pos, copied);
>  		__generic_write_end(inode, pos, copied, page);
> +		if (page_write_end)
> +			page_write_end(inode, pos, copied, page, iomap);
>  		return copied;
>  	}
>  
> +	if (page_write_end)
> +		page_write_end(inode, pos, copied, page, iomap);
>  	ret = generic_write_end(NULL, inode->i_mapping, pos, len,
>  			copied, page, NULL);
>  	if (ret < len)
> @@ -198,11 +204,17 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len,





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux