lkml.org 
[lkml]   [2022]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 15/20] block, blksnap: snapshot image block device
From

>
>> +static int snapimage_init_request(struct blk_mq_tag_set *set,
>> + struct request *rq, unsigned int hctx_idx,
>> + unsigned int numa_node)
>> +{
>> + struct snapimage_cmd *cmd = blk_mq_rq_to_pdu(rq);
>> +
>> + kthread_init_work(&cmd->work, snapimage_queue_work);
>> + return 0;
>> +}
> I'm a little confused on why this both has a blk-mq interface and
> the new bio filter interface. Whow is going to submit I/O to this
> blk-mq interface?
>

Sorry, it seems to me that I didn't understand this comment.

The module creates a block device for each snapshot image.
To make a backup of a block device, the backup tool reads snapshot image.
This snapshot image block device allows to mount a file system on it
and perform the necessary preparation. If not for this requirement,
it would be possible to implement reading via an additional ioctl.
But that wouldn't be a good design, I think.

Perhaps I have implemented this block device incorrectly?
Processing requests of the snapshot image block device is started
in the function snapimage_queue_rq(). And ends in the
snapimage_queue_work() in another kernel thread. Therefore, when
the request is initialized in snapimage_init_request(), a kernel worker
is prepared.

>> + //.open = snapimage_open,
>> + //.ioctl = snapimage_ioctl,
>> + //.release = snapimage_close,
> Please don't leave commented out code around.
>

\
 
 \ /
  Last update: 2022-07-07 11:17    [W:0.993 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site