lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 15/20] block, blksnap: snapshot image block device
    > +#include <linux/cdrom.h>

    What do you need this for?

    > +static int new_minor(int *minor, void *ptr)
    > +{
    > + int ret;
    > +
    > + idr_preload(GFP_KERNEL);
    > + spin_lock(&_minor_lock);
    > +
    > + ret = idr_alloc(&_minor_idr, ptr, 0, 1 << MINORBITS, GFP_NOWAIT);
    > +
    > + spin_unlock(&_minor_lock);
    > + idr_preload_end();
    > +
    > + if (ret < 0)
    > + return ret;
    > +
    > + *minor = ret;
    > + return 0;
    > +}

    alloc_disk not automatically allocates minors for you if you don't
    set the ->major and ->first_minor fields, which could simply this
    a lot.

    > +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?

    > + //.open = snapimage_open,
    > + //.ioctl = snapimage_ioctl,
    > + //.release = snapimage_close,

    Please don't leave commented out code around.

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