Re: [PATCH 4/4] xen/blkback: move blkif_get_x86_*_req() into blkback.c

From: Roger Pau Monné
Date: Tue Mar 14 2023 - 10:01:59 EST


On Fri, Dec 16, 2022 at 03:58:16PM +0100, Juergen Gross wrote:
> There is no need to have the functions blkif_get_x86_32_req() and
> blkif_get_x86_64_req() in a header file, as they are used in one place
> only.
>
> So move them into the using source file and drop the inline qualifier.
>
> While at it fix some style issues, and simplify the code by variable
> reusing and using min() instead of open coding it.
>
> Instead of using barrier() use READ_ONCE() for avoiding multiple reads
> of nr_segments.
>
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
> drivers/block/xen-blkback/blkback.c | 104 ++++++++++++++++++++++++++++
> drivers/block/xen-blkback/common.h | 96 -------------------------
> 2 files changed, 104 insertions(+), 96 deletions(-)
>
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index 243712b59a05..7561fdb72c13 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -1072,7 +1072,111 @@ static void end_block_io_op(struct bio *bio)
> bio_put(bio);
> }
>
> +static void blkif_get_x86_32_req(struct blkif_request *dst,
> + struct blkif_x86_32_request *src)

src can be const.

> +{
> + int i, n;

Could we also take the opportunity to convert i and n to unsigned?

With that:

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks, Roger.