Re: [PATCH 06/10] pnfsblock: init pg_bsize properly

Boaz Harrosh
2011-09-23T05:21:55Z

On 09/23/2011 04:50 AM, Jim Rees wrote:
> From: Peng Tao <bergwolf@gmail.com>
>
> pg_bsize is server->wsize/rsize by default. We would want to use the lseg
> length.
>
> Signed-off-by: Peng Tao <peng_tao@emc.com>
> Signed-off-by: Jim Rees <rees@umich.edu>

If you want to get lazy about this patch and take the easy way out.
The least you can do is supply the same fix to that other place
that has the same bug.

This is not nice. You have identified a deficiency in the generic
layer, You know that objects would have the same bug, (because I told you)
and you just don't care. I have spent plenty of times slaving over
blocks code when changing or fixing generic layer. (And Benny even more
then me)

And when you will actually send a patch that does exactly the same in
two places, which access only generic members, you might see that it
might be better to fix it in a single place at the generic layer.

NACK. I'm ok with getting lazy like below, but only if you also
add the same code to objio_osd.c

Sigh
Boaz

> ---
> fs/nfs/blocklayout/blocklayout.c | 20 ++++++++++++++++++--
> 1 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
> index 2167ba2..f5a7fa6 100644
> --- a/fs/nfs/blocklayout/blocklayout.c
> +++ b/fs/nfs/blocklayout/blocklayout.c
> @@ -923,14 +923,30 @@ bl_clear_layoutdriver(struct nfs_server *server)
> return 0;
> }
>
> +static void bl_pg_init_read(struct nfs_pageio_descriptor *pgio,
> + struct nfs_page *req)
> +{
> + pnfs_generic_pg_init_read(pgio, req);
> + if (pgio->pg_lseg)
> + pgio->pg_bsize = pgio->pg_lseg->pls_range.length;
> +}
> +
> +static void bl_pg_init_write(struct nfs_pageio_descriptor *pgio,
> + struct nfs_page *req)
> +{
> + pnfs_generic_pg_init_write(pgio, req);
> + if (pgio->pg_lseg)
> + pgio->pg_bsize = pgio->pg_lseg->pls_range.length;
> +}
> +
> static const struct nfs_pageio_ops bl_pg_read_ops = {
> - .pg_init = pnfs_generic_pg_init_read,
> + .pg_init = bl_pg_init_read,
> .pg_test = pnfs_generic_pg_test,
> .pg_doio = pnfs_generic_pg_readpages,
> };
>
> static const struct nfs_pageio_ops bl_pg_write_ops = {
> - .pg_init = pnfs_generic_pg_init_write,
> + .pg_init = bl_pg_init_write,
> .pg_test = pnfs_generic_pg_test,
> .pg_doio = pnfs_generic_pg_writepages,
> };