[PATCH] nvmet: avoid unnecessary fsync and flush bio

Guixin Liu kanie at linux.alibaba.com
Sun Jul 24 19:18:38 PDT 2022


在 2022/7/22 23:06, Christoph Hellwig 写道:
> On Fri, Jul 22, 2022 at 08:12:24PM +0800, Guixin Liu wrote:
>> @@ -333,10 +333,16 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
>>   static void nvmet_bdev_execute_flush(struct nvmet_req *req)
>>   {
>>   	struct bio *bio = &req->b.inline_bio;
>> +	struct request_queue *q = req->ns->bdev->bd_queue;
>>   
>>   	if (!nvmet_check_transfer_len(req, 0))
>>   		return;
>>   
>> +	if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags)) {
> This should be using a bdev_write_cache.
I will change that in the v2, thanks.
>
> But more importantly:  if the backend does not have a volatile write
> cache, and we should not even receive flushes from the remote side.

The vwc is in the ctroller data struct, not every each namespace. 
Currently, the vwc in

the nvmet_ctrl is always 1 to avoid some of the namespaces`s vwc are 
present, other namespaces`s

vwc are not present, therefore we can not set vwc = 0 to avoid receive 
flushes.

>
>> +	if (req->ns->buffered_io)
>> +		return errno_to_nvme_status(req, vfs_fsync(req->ns->file, 1));
>> +	else
>> +		return errno_to_nvme_status(req, 0);
> No need for the else, and the simple success case can just use the
> constant status and does not need a translation.

I will fix that in v2, thanks.

Best regards,

Guixin Liu




More information about the Linux-nvme mailing list