Re: [PATCH 1/2] fs: use mapping_set_error instead of opencoded set_bit

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

 



On Mon, 12 Sep 2016 13:16:07 +0200 Michal Hocko <mhocko@xxxxxxxxxx> wrote:

> From: Michal Hocko <mhocko@xxxxxxxx>
> 
> mapping_set_error helper sets the correct AS_ flag for the mapping so
> there is no reason to open code it. Use the helper directly.
> 
> ...
>
> --- a/drivers/staging/lustre/lustre/llite/vvp_page.c
> +++ b/drivers/staging/lustre/lustre/llite/vvp_page.c
> @@ -247,10 +247,7 @@ static void vvp_vmpage_error(struct inode *inode, struct page *vmpage, int ioret
>  		obj->vob_discard_page_warned = 0;
>  	} else {
>  		SetPageError(vmpage);
> -		if (ioret == -ENOSPC)
> -			set_bit(AS_ENOSPC, &inode->i_mapping->flags);
> -		else
> -			set_bit(AS_EIO, &inode->i_mapping->flags);
> +		mapping_set_error(inode->i_mapping, ioret);
>  
>  		if ((ioret == -ESHUTDOWN || ioret == -EINTR) &&
>  		     obj->vob_discard_page_warned == 0) {
> diff --git a/fs/afs/write.c b/fs/afs/write.c
> index 14d506efd1aa..20ed04ab833c 100644
> --- a/fs/afs/write.c
> +++ b/fs/afs/write.c
> @@ -398,8 +398,7 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
>  		switch (ret) {
>  		case -EDQUOT:
>  		case -ENOSPC:
> -			set_bit(AS_ENOSPC,
> -				&wb->vnode->vfs_inode.i_mapping->flags);
> +			mapping_set_error(wb->vnode->vfs_inode.i_mapping, -ENOSPC);
>  			break;
>  		case -EROFS:
>  		case -EIO:
> @@ -409,7 +408,7 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
>  		case -ENOMEDIUM:
>  		case -ENXIO:
>  			afs_kill_pages(wb->vnode, true, first, last);
> -			set_bit(AS_EIO, &wb->vnode->vfs_inode.i_mapping->flags);
> +			mapping_set_error(wb->vnode->vfs_inode.i_mapping, -ENXIO);

This one is a functional change: mapping_set_error() will rewrite
-ENXIO into -EIO.  Doesn't seem at all important though.

> ...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



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