[PATCH v5 4/6] erofs: make the size of read data stored in buffer_ofs

Jingbo Xu posted 6 patches 2 years, 8 months ago
There is a newer version of this series
[PATCH v5 4/6] erofs: make the size of read data stored in buffer_ofs
Posted by Jingbo Xu 2 years, 8 months ago
Since now xattr_iter structures have been unified, make the size of the
read data stored in buffer_ofs.  Don't bother reusing buffer_size for
this use, which may be confusing.

This is in preparation for the following further cleanup.

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
 fs/erofs/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index a691d539ae4f..19f9bf67440c 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -337,7 +337,7 @@ static int xattr_checkbuffer(struct erofs_xattr_iter *it,
 {
 	int err = it->buffer_size < value_sz ? -ERANGE : 0;
 
-	it->buffer_size = value_sz;
+	it->buffer_ofs = value_sz;
 	return !it->buffer ? 1 : err;
 }
 
@@ -370,7 +370,7 @@ static int inline_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
 		if (ret != -ENOATTR)
 			break;
 	}
-	return ret ? ret : it->buffer_size;
+	return ret ? ret : it->buffer_ofs;
 }
 
 static int shared_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
@@ -392,7 +392,7 @@ static int shared_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
 		if (ret != -ENOATTR)
 			break;
 	}
-	return ret ? ret : it->buffer_size;
+	return ret ? ret : it->buffer_ofs;
 }
 
 static bool erofs_xattr_user_list(struct dentry *dentry)
-- 
2.19.1.6.gb485710b
Re: [PATCH v5 4/6] erofs: make the size of read data stored in buffer_ofs
Posted by Gao Xiang 2 years, 8 months ago

On 2023/6/1 10:43, Jingbo Xu wrote:
> Since now xattr_iter structures have been unified, make the size of the
> read data stored in buffer_ofs.  Don't bother reusing buffer_size for
> this use, which may be confusing.
> 
> This is in preparation for the following further cleanup.
> 
> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>   fs/erofs/xattr.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
> index a691d539ae4f..19f9bf67440c 100644
> --- a/fs/erofs/xattr.c
> +++ b/fs/erofs/xattr.c
> @@ -337,7 +337,7 @@ static int xattr_checkbuffer(struct erofs_xattr_iter *it,
>   {
>   	int err = it->buffer_size < value_sz ? -ERANGE : 0;
>   
> -	it->buffer_size = value_sz;
> +	it->buffer_ofs = value_sz;
>   	return !it->buffer ? 1 : err;
>   }
>   
> @@ -370,7 +370,7 @@ static int inline_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
>   		if (ret != -ENOATTR)
>   			break;
>   	}
> -	return ret ? ret : it->buffer_size;
> +	return ret ? ret : it->buffer_ofs;
>   }
>   
>   static int shared_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
> @@ -392,7 +392,7 @@ static int shared_getxattr(struct inode *inode, struct erofs_xattr_iter *it)
>   		if (ret != -ENOATTR)
>   			break;
>   	}
> -	return ret ? ret : it->buffer_size;
> +	return ret ? ret : it->buffer_ofs;
>   }
>   
>   static bool erofs_xattr_user_list(struct dentry *dentry)