All of lore.kernel.org
 help / color / mirror / Atom feed
* [pnfs][PATCH 1/2]pnfs: replace lease_bitmap to length 3, instead of 2.
@ 2009-06-29  2:16 Tao Guo
       [not found] ` <4A485B7C.2000809@desy.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Tao Guo @ 2009-06-29  2:16 UTC (permalink / raw)
  To: Benny Halevy; +Cc: Fredric Isaman, bfields, linux-nfs, pnfs

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index b1e3ce2..231ad24 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2619,7 +2619,7 @@ static int
nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str
        struct compound_hdr hdr = {
                .nops   = 0,
        };
-       const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 };
+       const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME, 0, 0 };

        xdr_init_encode(&xdr, &req->rq_snd_buf, p);
        encode_compound_hdr(&xdr, req, &hdr);
@@ -2770,7 +2770,7 @@ static int nfs4_xdr_enc_get_lease_time(struct
rpc_rqst *req, uint32_t *p,
        struct compound_hdr hdr = {
                .minorversion = clp->cl_minorversion,
        };
-       const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 };
+       const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0, 0 };

        xdr_init_encode(&xdr, &req->rq_snd_buf, p);
        encode_compound_hdr(&xdr, req, &hdr);

-- 
tao.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [pnfs] [PATCH 1/2]pnfs: replace lease_bitmap to length 3, instead of 2.
       [not found] ` <4A485B7C.2000809@desy.de>
@ 2009-06-29  6:50   ` Tao Guo
       [not found]     ` <318b7ac70906282350u71c641dbu584b4e84cd39d59d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Tao Guo @ 2009-06-29  6:50 UTC (permalink / raw)
  To: Tigran Mkrtchyan, Benny Halevy; +Cc: Fredric Isaman, bfields, linux-nfs, pnfs

I think you are right, thanks.
shame to make such a mistake -_-|||

But I think giving the explicit size will  make the code much more clea=
r.
what about other gurus' ideas?
---

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index b1e3ce2..8cdccc0 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2619,7 +2619,7 @@ static int
nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str
 	struct compound_hdr hdr =3D {
 		.nops	=3D 0,
 	};
-	const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 };
+	const u32 lease_bitmap[3] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };

 	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
 	encode_compound_hdr(&xdr, req, &hdr);
@@ -2770,7 +2770,7 @@ static int nfs4_xdr_enc_get_lease_time(struct
rpc_rqst *req, uint32_t *p,
 	struct compound_hdr hdr =3D {
 		.minorversion =3D clp->cl_minorversion,
 	};
-	const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 };
+	const u32 lease_bitmap[3] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };

 	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
 	encode_compound_hdr(&xdr, req, &hdr);


On Mon, Jun 29, 2009 at 2:13 PM, Tigran
Mkrtchyan<tigran.mkrtchyan@desy.de> wrote:
>
>
> On 06/29/2009 04:16 AM, Tao Guo wrote:
>>
>> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
>> index b1e3ce2..231ad24 100644
>> --- a/fs/nfs/nfs4xdr.c
>> +++ b/fs/nfs/nfs4xdr.c
>> @@ -2619,7 +2619,7 @@ static int
>> nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, st=
r
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct compound_hdr hdr =3D {
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .nops =C2=A0=
 =3D 0,
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 };
>> - =C2=A0 =C2=A0 =C2=A0 const u32 lease_bitmap[2] =3D { FATTR4_WORD0_=
LEASE_TIME, 0 };
>> + =C2=A0 =C2=A0 =C2=A0 const u32 lease_bitmap[3] =3D { FATTR4_WORD0_=
LEASE_TIME, 0, 0 };
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 xdr_init_encode(&xdr,&req->rq_snd_buf, p=
);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 encode_compound_hdr(&xdr, req,&hdr);
>> @@ -2770,7 +2770,7 @@ static int nfs4_xdr_enc_get_lease_time(struct
>> rpc_rqst *req, uint32_t *p,
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct compound_hdr hdr =3D {
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .minorversio=
n =3D clp->cl_minorversion,
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 };
>> - =C2=A0 =C2=A0 =C2=A0 const u32 lease_bitmap[2] =3D { FATTR4_WORD0_=
LEASE_TIME, 0 };
>> + =C2=A0 =C2=A0 =C2=A0 const u32 lease_bitmap[2] =3D { FATTR4_WORD0_=
LEASE_TIME, 0, 0 };
>
> probably you have to increase array size as well. In general there is=
 no
> need to do it twice :
>
> const u32 lease_bitmap[] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>
> will do the right think.
>
> Kernel gurus may correct me if I am wrong.
>
> Regards,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0Tigran.
>
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 xdr_init_encode(&xdr,&req->rq_snd_buf, p=
);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 encode_compound_hdr(&xdr, req,&hdr);
>>
>
> --
> _____________________________________________________________________=
___
> Tigran Mkrtchyan =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 DESY, IT,
> tigran.mkrtchyan@desy.de =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Notkestrasse 85,
> Tel: + 49 40 89983946 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Hamburg 22607,
> Fax: + 49 40 89984429 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Germany.
>



--=20
tao.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [pnfs] [PATCH 1/2]pnfs: replace lease_bitmap to length 3, instead of 2.
       [not found]     ` <318b7ac70906282350u71c641dbu584b4e84cd39d59d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-06-29  8:02       ` Benny Halevy
  0 siblings, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2009-06-29  8:02 UTC (permalink / raw)
  To: Tao Guo; +Cc: Tigran Mkrtchyan, Fredric Isaman, bfields, linux-nfs, pnfs

On Jun. 29, 2009, 9:50 +0300, Tao Guo <glorioustao@gmail.com> wrote:
> I think you are right, thanks.

Thanks for catching and fixing this!
Note that the compiler does print a warning about it though:

fs/nfs/nfs4xdr.c: In function =E2=80=98nfs4_xdr_enc_get_lease_time=E2=80=
=99:
fs/nfs/nfs4xdr.c:2715: warning: excess elements in array initializer
fs/nfs/nfs4xdr.c:2715: warning: (near initialization for =E2=80=98lease=
_bitmap=E2=80=99)

> shame to make such a mistake -_-|||

>=20
> But I think giving the explicit size will  make the code much more cl=
ear.
> what about other gurus' ideas?

I'm fine with that.
Especially since it was previously initialized with an explicit length.

> ---
>=20
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index b1e3ce2..8cdccc0 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -2619,7 +2619,7 @@ static int
> nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str

Hmm, this patch is still malformatted.
(lines wrapped, tabs expanded to spaces)
I've fixed it manually.

Benny

>  	struct compound_hdr hdr =3D {
>  		.nops	=3D 0,
>  	};
> -	const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 };
> +	const u32 lease_bitmap[3] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>=20
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
> @@ -2770,7 +2770,7 @@ static int nfs4_xdr_enc_get_lease_time(struct
> rpc_rqst *req, uint32_t *p,
>  	struct compound_hdr hdr =3D {
>  		.minorversion =3D clp->cl_minorversion,
>  	};
> -	const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 };
> +	const u32 lease_bitmap[3] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>=20
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
>=20
>=20
> On Mon, Jun 29, 2009 at 2:13 PM, Tigran
> Mkrtchyan<tigran.mkrtchyan@desy.de> wrote:
>>
>> On 06/29/2009 04:16 AM, Tao Guo wrote:
>>> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
>>> index b1e3ce2..231ad24 100644
>>> --- a/fs/nfs/nfs4xdr.c
>>> +++ b/fs/nfs/nfs4xdr.c
>>> @@ -2619,7 +2619,7 @@ static int
>>> nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, s=
tr
>>>         struct compound_hdr hdr =3D {
>>>                 .nops   =3D 0,
>>>         };
>>> -       const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 =
};
>>> +       const u32 lease_bitmap[3] =3D { FATTR4_WORD0_LEASE_TIME, 0,=
 0 };
>>>
>>>         xdr_init_encode(&xdr,&req->rq_snd_buf, p);
>>>         encode_compound_hdr(&xdr, req,&hdr);
>>> @@ -2770,7 +2770,7 @@ static int nfs4_xdr_enc_get_lease_time(struct
>>> rpc_rqst *req, uint32_t *p,
>>>         struct compound_hdr hdr =3D {
>>>                 .minorversion =3D clp->cl_minorversion,
>>>         };
>>> -       const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0 =
};
>>> +       const u32 lease_bitmap[2] =3D { FATTR4_WORD0_LEASE_TIME, 0,=
 0 };
>> probably you have to increase array size as well. In general there i=
s no
>> need to do it twice :
>>
>> const u32 lease_bitmap[] =3D { FATTR4_WORD0_LEASE_TIME, 0, 0 };
>>
>> will do the right think.
>>
>> Kernel gurus may correct me if I am wrong.
>>
>> Regards,
>>        Tigran.
>>
>>>         xdr_init_encode(&xdr,&req->rq_snd_buf, p);
>>>         encode_compound_hdr(&xdr, req,&hdr);
>>>
>> --
>> ____________________________________________________________________=
____
>> Tigran Mkrtchyan                               DESY, IT,
>> tigran.mkrtchyan@desy.de                       Notkestrasse 85,
>> Tel: + 49 40 89983946                          Hamburg 22607,
>> Fax: + 49 40 89984429                          Germany.
>>
>=20
>=20
>=20

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-29  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29  2:16 [pnfs][PATCH 1/2]pnfs: replace lease_bitmap to length 3, instead of 2 Tao Guo
     [not found] ` <4A485B7C.2000809@desy.de>
2009-06-29  6:50   ` [pnfs] [PATCH " Tao Guo
     [not found]     ` <318b7ac70906282350u71c641dbu584b4e84cd39d59d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-29  8:02       ` Benny Halevy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.