From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>,
"hch@infradead.org" <hch@infradead.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Dong Yang Li <lidongyang@suse.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH 3/3] xen/blk[front|back]: Enhance discard support with secure erasing support.
Date: Wed, 12 Oct 2011 13:21:30 -0400 [thread overview]
Message-ID: <20111012172130.GC1732@phenom.oracle.com> (raw)
In-Reply-To: <1318436097.21903.762.camel@zakaz.uk.xensource.com>
> > if (operation != REQ_DISCARD)
> > /* Check that the number of segments is sane. */
> > nseg = req->nr_segments;
> > else
> > nseg = 0;
>
> Right above this hunk is a switch statement over the req->operation. The
> value of req->operation precisely defines the semantics/validity or
> otherwise of the req->nr_segments field and whether or not it contains
> the nr of segments or (due to the aliasing) something else. Why not set
> nsegs inside that switch statement (and explicitly zero it in the other
> cases) so that this obvious connection is retained?
Sure.
>
> > > > if (unlikely(nseg == 0 && operation != WRITE_FLUSH &&
> > > > operation != REQ_DISCARD) ||
> >
> > And I guess we can also skip the REQ_DISCARD test here.
>
> I don't think so, if nseg == 0 and operation == REQ_DISCARD that is
> fine, right? The fact that there is all this "operation != xx &&
<nods>
..snip..
> (I think I'm right that BLKIF_OP_FLUSH_DISKCACHE can have associated
> data or not)
You are right.
>
> However do discard and r/w really have so much in common that handling
> them all in dispatch_rw_block_io() and relying on nsegs == 0 when the
> operation is discard makes sense?
>
> Would it be clearer if the caller (__do_block_io_op) had this switch
> over req->operation and called dispatch_rw_block_io(req, WRITE_FLUSH,
> nsegs), dispatch_discard(req) etc as appropriate?
Potentially. It would cut down on this functions bloated size so that
is a definite plus.
next prev parent reply other threads:[~2011-10-12 17:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 15:28 [PATCH] Xen block fixes, secure discard, and barrier support for 3.2 (v1) Konrad Rzeszutek Wilk
2011-10-10 15:28 ` [PATCH 1/3] xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests Konrad Rzeszutek Wilk
2011-10-17 11:36 ` Jan Beulich
2011-10-17 16:50 ` Konrad Rzeszutek Wilk
2011-10-17 12:27 ` Jan Beulich
2011-10-17 16:52 ` Konrad Rzeszutek Wilk
2011-10-10 15:28 ` [PATCH 2/3] xen/blkback: Fix the inhibition to map pages when discarding sector ranges Konrad Rzeszutek Wilk
2011-10-11 7:25 ` Jan Beulich
[not found] ` <4E940B99020000780005AA12@victor.provo.novell.com>
2011-10-11 7:33 ` Li Dongyang
2011-10-11 18:39 ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-10-11 20:50 ` Konrad Rzeszutek Wilk
2011-10-12 10:18 ` Jan Beulich
2011-10-12 10:30 ` Ian Campbell
2011-10-10 15:28 ` [PATCH 3/3] xen/blk[front|back]: Enhance discard support with secure erasing support Konrad Rzeszutek Wilk
2011-10-10 16:13 ` [Xen-devel] " Ian Campbell
2011-10-10 16:42 ` Konrad Rzeszutek Wilk
2011-10-10 17:53 ` Konrad Rzeszutek Wilk
2011-10-10 19:19 ` Ian Campbell
2011-10-10 19:20 ` Ian Campbell
2011-10-10 19:57 ` Konrad Rzeszutek Wilk
2011-10-11 7:36 ` Jan Beulich
2011-10-11 8:09 ` Ian Campbell
2011-10-11 15:51 ` Konrad Rzeszutek Wilk
2011-10-11 20:57 ` Konrad Rzeszutek Wilk
2011-10-12 10:54 ` Ian Campbell
2011-10-12 15:45 ` Konrad Rzeszutek Wilk
2011-10-12 16:14 ` Ian Campbell
2011-10-12 17:21 ` Konrad Rzeszutek Wilk [this message]
2011-10-17 13:23 ` Jan Beulich
2011-10-21 0:06 ` Konrad Rzeszutek Wilk
[not found] ` <4E9C4855020000780005BA73@victor.provo.novell.com>
2011-10-20 3:17 ` Li Dongyang
2011-10-20 3:46 ` Konrad Rzeszutek Wilk
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=20111012172130.GC1732@phenom.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=hch@infradead.org \
--cc=lidongyang@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).