On Tue, Apr 17, 2012 at 12:13 PM, Myklebust, Trond
<Trond.Myklebust@xxxxxxxxxx> wrote:
> On Tue, 2012-04-17 at 11:37 -0400, Fred Isaman wrote:
>> On Mon, Apr 16, 2012 at 4:28 PM, Myklebust, Trond
>> <Trond.Myklebust@xxxxxxxxxx> wrote:
>> > On Mon, 2012-04-09 at 16:52 -0400, Fred Isaman wrote:
>> >> @@ -64,10 +80,16 @@ void nfs_readhdr_free(struct nfs_pgio_header *hdr)
>> >>
>> >> void nfs_readdata_release(struct nfs_read_data *rdata)
>> >> {
>> >> + struct nfs_pgio_header *hdr = rdata->header;
>> >> +
>> >> put_nfs_open_context(rdata->args.context);
>> >> if (rdata->pages.pagevec != rdata->pages.page_array)
>> >> kfree(rdata->pages.pagevec);
>> >> - nfs_readhdr_free(rdata->header);
>> >> + if (container_of(hdr, struct nfs_read_header, header) !=
>> >> + container_of(rdata, struct nfs_read_header, rpc_data))
>> >> + kfree(rdata);
>> >
>> > This looks unnecessarily complicated. How about
>> >
>> > if (rdata != &hdr->rpc_data)
>> > kfree(rdata);
>> >
>>
>> That won't work. There is no hdr->rpc_data.
>
> Doh! Make that
>
> struct nfs_read_header *read_header = container_of(hdr, struct....);
>
> if (rdata != &read_header->rpc_data)
> kfree(rdata);
>
> The reason for preferring the above line is that I can trivially see
> that the reason why I don't want to do the kfree() is because I'm
> pointing at a field inside the read_header.
>
OK.
Fred
--
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
[Linux USB Development]
[Linux Media Development]
[Video for Linux]
[Linux NILFS]
[Linux Audio Users]
[Photo]
[Yosemite Info]
[Yosemite Photos]
[POF Sucks]
[Linux Kernel]
[Linux SCSI]
[XFree86]