linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk, hch@lst.de,
	Minwoo Im <minwoo.im.dev@gmail.com>
Subject: Re: [PATCH 4/8] null_blk: allow memory-backed write-zeroes-req
Date: Sun, 28 Jul 2019 15:11:12 +0900	[thread overview]
Message-ID: <20190728061112.GF24390@minwoo-desktop> (raw)
In-Reply-To: <20190711175328.16430-5-chaitanya.kulkarni@wdc.com>

On 19-07-11 10:53:24, Chaitanya Kulkarni wrote:
> This patch adds support for memory backed REQ_OP_WRITE_ZEROES
> operations for the null_blk request mode. We introduce two new
> functions where we zeroout the sector(s) using memset which are part
> of the payloadless write-zeroes request.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/block/null_blk_main.c | 45 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
> index 65da7c2d93b9..fca011a05277 100644
> --- a/drivers/block/null_blk_main.c
> +++ b/drivers/block/null_blk_main.c
> @@ -725,6 +725,24 @@ static void null_free_sector(struct nullb *nullb, sector_t sector,
>  	}
>  }
>  
> +static void null_zero_sector(struct nullb_device *d, sector_t sect,
> +			     sector_t nr_sects, bool cache)
> +{
> +	struct radix_tree_root *root = cache ? &d->cache : &d->data;
> +	struct nullb_page *t_page;
> +	unsigned int offset;
> +	void *dest;
> +
> +	t_page = radix_tree_lookup(root, sect >> PAGE_SECTORS_SHIFT);
> +	if (!t_page)
> +		return;
> +
> +	offset = (sect & SECTOR_MASK) << SECTOR_SHIFT;
> +	dest = kmap_atomic(t_page->page);
> +	memset(dest + offset, 0, SECTOR_SIZE * nr_sects);
> +	kunmap_atomic(dest);
> +}
> +
>  static struct nullb_page *null_radix_tree_insert(struct nullb *nullb, u64 idx,
>  	struct nullb_page *t_page, bool is_cache)
>  {
> @@ -1026,6 +1044,25 @@ static void null_handle_discard(struct nullb *nullb, sector_t sector, size_t n)
>  	spin_unlock_irq(&nullb->lock);
>  }
>  
> +static void null_handle_write_zeroes(struct nullb *nullb, sector_t sector,
> +				     unsigned int bytes_left)
> +{
> +	sector_t nr_sectors;
> +	size_t curr_bytes;
> +
> +	spin_lock_irq(&nullb->lock);
> +	while (bytes_left > 0) {

Hi Chaitanya,

Thanks for your support for this!

I have a simple query here.  Is there any recommended rule about using
the function argument to be changed inside of that function like
_bytes_left_?  I'm not against it, but I'd like to know if it's okay to
decrement inside of this function in code-style point-of-view.

Thanks!

  reply	other threads:[~2019-07-28  6:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 17:53 [PATCH 0/8] null_blk: add missing write-zeroes and discard support Chaitanya Kulkarni
2019-07-11 17:53 ` [PATCH 1/8] null_blk: add module parameter for REQ_OP_DISCARD Chaitanya Kulkarni
2019-07-28  6:04   ` Minwoo Im
2019-07-30  4:48     ` Chaitanya Kulkarni
2019-07-11 17:53 ` [PATCH 2/8] null_blk: add REQ_OP_WRITE_ZEROES config property Chaitanya Kulkarni
2019-07-28  6:17   ` Minwoo Im
2019-07-11 17:53 ` [PATCH 3/8] null_blk: add support for write-zeroes Chaitanya Kulkarni
2019-07-28  6:08   ` Minwoo Im
2019-07-11 17:53 ` [PATCH 4/8] null_blk: allow memory-backed write-zeroes-req Chaitanya Kulkarni
2019-07-28  6:11   ` Minwoo Im [this message]
2019-07-11 17:53 ` [PATCH 5/8] null_blk: code cleaup Chaitanya Kulkarni
2019-07-28  6:12   ` Minwoo Im
2019-07-11 17:53 ` [PATCH 6/8] null_blk: allow memory-backed write-zeroes-bio Chaitanya Kulkarni
2019-07-28  6:18   ` Minwoo Im
2019-07-11 17:53 ` [PATCH 7/8] null_blk: add support for configfs write_zeroes Chaitanya Kulkarni
2019-07-11 17:53 ` [PATCH 8/8] null_blk: adjusts the code with latest changes Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190728061112.GF24390@minwoo-desktop \
    --to=minwoo.im.dev@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).