From: Kent Overstreet <kent.overstreet@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>,
Shaohua Li <shli@kernel.org>,
linux-raid@vger.kernel.org
Subject: Re: [PATCH 2/6] md: convert to kvmalloc
Date: Fri, 7 Sep 2018 14:16:10 -0400 [thread overview]
Message-ID: <20180907181610.GB29485@kmo-pixel> (raw)
In-Reply-To: <20180907174942.GB3425@bombadil.infradead.org>
On Fri, Sep 07, 2018 at 10:49:42AM -0700, Matthew Wilcox wrote:
> On Fri, Sep 07, 2018 at 12:56:31PM -0400, Kent Overstreet wrote:
> > @@ -165,7 +164,7 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
> > struct dma_async_tx_descriptor *tx)
> > {
> > int disks = sh->disks;
> > - struct page **srcs = flex_array_get(percpu->scribble, 0);
> > + struct page **srcs = percpu->scribble;
> > int count = 0, pd_idx = sh->pd_idx, i;
> > struct async_submit_ctl submit;
> >
> > @@ -196,8 +195,8 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
> > }
> >
> > init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, tx,
> > - NULL, sh, flex_array_get(percpu->scribble, 0)
> > - + sizeof(struct page *) * (sh->disks + 2));
> > + NULL, sh, percpu->scribble +
> > + sizeof(struct page *) * (sh->disks + 2));
>
> I think this would read better written as:
>
> init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, tx,
> NULL, sh, srcs + sh->disks + 2);
>
> > static addr_conv_t *to_addr_conv(struct stripe_head *sh,
> > struct raid5_percpu *percpu, int i)
> > {
> > - void *addr;
> > -
> > - addr = flex_array_get(percpu->scribble, i);
> > - return addr + sizeof(struct page *) * (sh->disks + 2);
> > + return percpu->scribble + i * percpu->scribble_obj_size +
> > + sizeof(struct page *) * (sh->disks + 2);
> > }
> >
> > /* return a pointer to the address conversion region of the scribble buffer */
> > static struct page **to_addr_page(struct raid5_percpu *percpu, int i)
> > {
> > - void *addr;
> > -
> > - addr = flex_array_get(percpu->scribble, i);
> > - return addr;
> > + return percpu->scribble + i * percpu->scribble_obj_size;
> > }
>
> Perhaps this would be better as ...
>
> static struct page **to_addr_page(struct raid5_percpu *percpu, int i)
> {
> - void *addr;
> -
> - addr = flex_array_get(percpu->scribble, i);
> - return addr;
> + return percpu->scribble + i * percpu->scribble_obj_size;
> }
>
> static addr_conv_t *to_addr_conv(struct stripe_head *sh,
> struct raid5_percpu *percpu, int i)
> {
> - void *addr;
> -
> - addr = flex_array_get(percpu->scribble, i);
> - return addr + sizeof(struct page *) * (sh->disks + 2);
> + return to_addr_page(percpu, i) + sh->disks + 2;
> }
>
>
> The rest looks good.
Need some casts (to void * or addr_conv_t *) but yeah, I suppose that's a bit
cleaner.
next prev parent reply other threads:[~2018-09-07 18:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 16:56 [PATCH 0/6] flex_arrays -> genradix; prep work for bcachefs Kent Overstreet
2018-09-07 16:56 ` [PATCH 1/6] openvswitch: convert to kvmalloc Kent Overstreet
2018-09-07 17:19 ` Matthew Wilcox
2018-09-07 16:56 ` [PATCH 2/6] md: " Kent Overstreet
2018-09-07 17:49 ` Matthew Wilcox
2018-09-07 18:16 ` Kent Overstreet [this message]
2018-09-07 16:56 ` [PATCH 3/6] selinux: " Kent Overstreet
2018-09-07 17:08 ` Tetsuo Handa
2018-09-07 17:50 ` Kent Overstreet
2018-09-13 2:27 ` Paul Moore
2018-09-07 16:56 ` [PATCH 4/6] Generic radix trees Kent Overstreet
2018-09-10 23:18 ` [PATCH] Generic radix tree: add kernel-doc chapter Randy Dunlap
2018-09-07 16:56 ` [PATCH 5/6] proc: commit to genradix Kent Overstreet
2018-09-07 16:56 ` [PATCH 6/6] Drop flex_arrays Kent Overstreet
2018-09-07 18:49 ` Randy Dunlap
2018-12-13 12:30 ` Xin Long
2018-12-13 14:41 ` Matthew Wilcox
2018-12-13 15:51 ` Neil Horman
2018-12-13 16:45 ` Matthew Wilcox
2018-12-13 18:09 ` Neil Horman
2018-12-17 12:50 ` Kent Overstreet
2018-12-18 12:19 ` Neil Horman
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=20180907181610.GB29485@kmo-pixel \
--to=kent.overstreet@gmail.com \
--cc=dave.hansen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=shli@kernel.org \
--cc=willy@infradead.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