Re: Question about ublk and NEED_GET_DATA

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

 



On 2023/4/19 08:03, Harris, James R wrote:

Hi,

Thanks for using the NEED_GET_DATA feature. 

> Hi,
> 
> I’m working on adding NEED_GET_DATA support to the SPDK ublk server, to avoid allocating I/O buffers until they are actually needed.

Yes, with NEED_GET_DATA, you don't have to preallocate I/O buffers for WRITE requests.

> 
> It is very clear how this works for write commands with NEED_GET_DATA.  We wait to allocate the buffer until we get UBLK_IO_RES_NEED_GET_DATA completion and submit again using UBLK_IO_NEED_GET_DATA.  After we get the UBLK_IO_RES_OK completion from ublk, we submit the block request to the SPDK bdev layer.  After it completes, we submit using UBLK_IO_COMMIT_AND_FETCH_REQ and can free the I/O buffer because the data has been committed.

Yes, you are right.

> 
> But how does this work for the read path?  On a read, I can wait to allocate the buffer until I get the UBLK_IO_RES_OK completion.  But after the read operation is completed and SPDK submits the UBLK_IO_COMMIT_AND_FETCH_REQ, how do I know when ublk has finished copying data out of the buffer so that I can reuse that buffer?
> 
> I’m sure I’m missing something obvious, if anyone can provide a pointer I would appreciate it.

In the WRITE path, data copy happens before the backend gets UBLK_IO_RES_OK.

In the READ path, data copy happens after the backend submits UBLK_IO_COMMIT_AND_FETCH_REQ,
but unfortunately we cannot know the time data copy happens because ublk driver does not notify
the backend until next request(on this tag) comes.

Regards,
Zhang

> 
> Thanks,
> 
> Jim Harris
> 





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux