Re: [PATCH v2 17/21] block, blksnap: snapshot image block device

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

 



On 9 Dec 2022 15:23:27 +0100 Sergei Shtepa <sergei.shtepa@xxxxxxxxx>
> Provides the operation of block devices of snapshot images. Read and
> write operations are redirected to the regions of difference blocks for
> block device (struct diff_area).
> 
> Signed-off-by: Sergei Shtepa <sergei.shtepa@xxxxxxxxx>
> ---

Thanks for your patchset.

> +static int snapimage_kthread_worker_fn(void *param)
> +{
> +	struct snapimage *snapimage = param;
> +	struct bio *bio;
> +	int ret = 0;
> +
> +	while (!kthread_should_stop()) {
> +		bio = get_bio_from_queue(snapimage);
> +		if (!bio) {
> +			schedule_timeout_interruptible(HZ / 100);
> +			continue;
> +		}

Given the wake_up_process() below, s$HZ / 100$HZ * 1000$ to avoid
unnecessary wakeups [1].

And because of no signal handling added, use schedule_timeout_idle() instead.

[1] https://lore.kernel.org/lkml/20210419085027.761150-2-elver@xxxxxxxxxx/

> +
> +		snapimage_process_bio(snapimage, bio);
> +	}
> +
> +	while ((bio = get_bio_from_queue(snapimage)))
> +		snapimage_process_bio(snapimage, bio);
> +
> +	return ret;
> +}
> +
> +static void snapimage_submit_bio(struct bio *bio)
> +{
> +	struct snapimage *snapimage = bio->bi_bdev->bd_disk->private_data;
> +	gfp_t gfp = GFP_NOIO;
> +
> +	if (bio->bi_opf & REQ_NOWAIT)
> +		gfp |= GFP_NOWAIT;
> +	if (snapimage->is_ready) {
> +		spin_lock(&snapimage->queue_lock);
> +		bio_list_add(&snapimage->queue, bio);
> +		spin_unlock(&snapimage->queue_lock);
> +
> +		wake_up_process(snapimage->worker);
> +	} else
> +		bio_io_error(bio);
> +}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux