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

Re: [dm-devel] [PATCH 1/2] block: fix leaks associated with discard request payload

On 06/27/2010 06:29 PM, James Bottomley wrote:
>> +		/*
>> +		 * If this is a discard request that originated from the kernel
>> +		 * we need to free our payload here.  Note that we need to check
>> +		 * the request flag as the normal payload rules apply for
>> +		 * pass-through UNMAP / WRITE SAME requests.
>> +		 */
>> +		__free_page(bio_page(cmd->request->bio));
> This is another layering violation:  the page is allocated in the Upper
> layer and freed in the mid-layer.

May I ask a silly question? Why the dynamic allocation?

Why not have a const-static single global page at the block-layer somewhere
that will be used for all discard-type operations and be done with it once and
for all. A single page can be used for any size bio , any number of concurrent
discards, any ZERO needed operation. It can also be used by other operations
like padding and others. In fact isn't there one for the libsata padding?

(It could be dynamical allocated on first use for embedded system)

just my $0.017

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