Re: [pnfs] [PATCH 1/2]pnfs: replace lease_bitmap to length 3, instead of 2.

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

 



On Jun. 29, 2009, 9:50 +0300, Tao Guo <glorioustao@xxxxxxxxx> 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 ‘nfs4_xdr_enc_get_lease_time’:
fs/nfs/nfs4xdr.c:2715: warning: excess elements in array initializer
fs/nfs/nfs4xdr.c:2715: warning: (near initialization for ‘lease_bitmap’)

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

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

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

> ---
> 
> 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 = {
>  		.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[3] = { 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@xxxxxxx> 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, 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 };
>> probably you have to increase array size as well. In general there is no
>> need to do it twice :
>>
>> const u32 lease_bitmap[] = { 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@xxxxxxx                       Notkestrasse 85,
>> Tel: + 49 40 89983946                          Hamburg 22607,
>> Fax: + 49 40 89984429                          Germany.
>>
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux