mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>,
	dm-devel@redhat.com, Jonathan Corbet <corbet@lwn.net>,
	Shaohua Li <shli@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org
Subject: Re: dm: add secdel target
Date: Fri, 19 Oct 2018 15:02:10 +0300	[thread overview]
Message-ID: <20181019120209.osicx2v3vebvsxqr@sole.flsd.net> (raw)
In-Reply-To: <20181018200124.GA6996@redhat.com>

On Thu, Oct 18, 2018 at 04:01:25PM -0400, Mike Snitzer wrote:
> On Sun, Oct 14 2018 at  7:24am -0400,
> Vitaly Chikunov <vt@altlinux.org> wrote:
> 
> > Report to the upper level ability to discard, and translate arriving
> > discards to the writes of random or zero data to the underlying level.
> > 
> > Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
> > ---
> >   This target is the same as the linear target except that is reports ability to
> >   discard to the upper level and translates arriving discards into sector
> >   overwrites with random (or zero) data.
> 
> There is a fair amount of code duplication between dm-linear.c and this
> new target.
> 
> Something needs to give, ideally you'd factor out methods that are
> shared by both targets, but those methods must _not_ introduce overhead
> to dm-linear.

I see three possible solutions:
 - integrate 'secdel' into dm-linear;
 - export functions like linear_dax_copy_to_iter and fill them into
   secdel's `struct target_type`;
 - call methods of linear's `struct target_type` from secdel's one.

> Could be that dm-linear methods just get called by the wrapper
> dm-sec-erase target (more on the "dm-sec-erase" name below).

> > diff --git a/drivers/md/dm-secdel.c b/drivers/md/dm-secdel.c
> > new file mode 100644
> > index 000000000000..9aeaf3f243c0
> > --- /dev/null
> > +++ b/drivers/md/dm-secdel.c
> ... 
> > +			if (mode == SECDEL_MODE_RAND) {
> > +				page = alloc_page(gfp_mask);
> > +				if (!page) {
> > +					DMERR("%s %lu[%lu]: no memory to allocate page for random data",
> > +					      __func__, sector, nr_sects);
> > +					/* will fallback to zero filling */
> 
> In general, performing memory allocations to service IO is something all
> DM core and DM targets must work to avoid.  This smells bad.
> 
> ...

Yes, but we need to create and write random data, so I don't see other
solution. In zero overwriting mode page is not allocated. And it's fall
back to zero overwriting if page allocation fails for random data.

> Mike

I will address these and other your concerns in v2.

Thanks!


  reply	other threads:[~2018-10-19 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14 11:24 [PATCH] " Vitaly Chikunov
2018-10-18 20:01 ` Mike Snitzer
2018-10-19 12:02   ` Vitaly Chikunov [this message]
2018-10-19  6:19 ` [dm-devel] [PATCH] " Christoph Hellwig
2018-10-19 11:49   ` Vitaly Chikunov
2018-10-19 12:00     ` Christoph Hellwig
2018-10-19 12:11       ` Vitaly Chikunov

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=20181019120209.osicx2v3vebvsxqr@sole.flsd.net \
    --to=vt@altlinux.org \
    --cc=agk@redhat.com \
    --cc=corbet@lwn.net \
    --cc=dm-devel@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@kernel.org \
    --cc=snitzer@redhat.com \
    /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

all inboxes | Powered by JetHome®