From: Kent Overstreet <koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org,
agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
neilb-l3A5Bk7waGM@public.gmane.org,
drbd-dev-cunTk1MwBs8qoQakbn7OcQ@public.gmane.org,
vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
mpatocka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
sage-BnTBU8nroG7k1uMJSBkQmQ@public.gmane.org,
yehuda-L5o5AL9CYN0tUFlbccrkMA@public.gmane.org,
Peter Osterlund <petero2-zq6IREYz3ykAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v5 04/12] pktcdvd: Switch to bio_kmalloc()
Date: Wed, 8 Aug 2012 17:08:50 -0700 [thread overview]
Message-ID: <20120809000850.GC7262@moria.home.lan> (raw)
In-Reply-To: <20120808221359.GC6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
On Wed, Aug 08, 2012 at 03:13:59PM -0700, Tejun Heo wrote:
> Hello,
>
> On Mon, Aug 06, 2012 at 03:08:33PM -0700, Kent Overstreet wrote:
> > This is prep work for killing bi_destructor - previously, pktcdvd had
> > its own pkt_bio_alloc which was basically duplication bio_kmalloc(),
> > necessitating its own bi_destructor implementation.
> >
> > v5: Un-reorder some functions, to make the patch easier to review
> >
> > Signed-off-by: Kent Overstreet <koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>
> Please Cc: the maintainers. Cc'ing Peter Osterlund and keeping the
> whole body for him.
Whoops, thanks.
> Generally looks good to me. How is this tested?
Untested - no hardware for it.
>
> Thanks.
>
> > ---
> > drivers/block/pktcdvd.c | 67 +++++++++++-----------------------------------
> > 1 files changed, 16 insertions(+), 51 deletions(-)
> >
> > diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> > index ba66e44..ae55f08 100644
> > --- a/drivers/block/pktcdvd.c
> > +++ b/drivers/block/pktcdvd.c
> > @@ -101,6 +101,8 @@ static struct dentry *pkt_debugfs_root = NULL; /* /sys/kernel/debug/pktcdvd */
> > static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev);
> > static int pkt_remove_dev(dev_t pkt_dev);
> > static int pkt_seq_show(struct seq_file *m, void *p);
> > +static void pkt_end_io_read(struct bio *bio, int err);
> > +static void pkt_end_io_packet_write(struct bio *bio, int err);
> >
> >
> >
> > @@ -522,38 +524,6 @@ static void pkt_bio_finished(struct pktcdvd_device *pd)
> > }
> > }
> >
> > -static void pkt_bio_destructor(struct bio *bio)
> > -{
> > - kfree(bio->bi_io_vec);
> > - kfree(bio);
> > -}
> > -
> > -static struct bio *pkt_bio_alloc(int nr_iovecs)
> > -{
> > - struct bio_vec *bvl = NULL;
> > - struct bio *bio;
> > -
> > - bio = kmalloc(sizeof(struct bio), GFP_KERNEL);
> > - if (!bio)
> > - goto no_bio;
> > - bio_init(bio);
> > -
> > - bvl = kcalloc(nr_iovecs, sizeof(struct bio_vec), GFP_KERNEL);
> > - if (!bvl)
> > - goto no_bvl;
> > -
> > - bio->bi_max_vecs = nr_iovecs;
> > - bio->bi_io_vec = bvl;
> > - bio->bi_destructor = pkt_bio_destructor;
> > -
> > - return bio;
> > -
> > - no_bvl:
> > - kfree(bio);
> > - no_bio:
> > - return NULL;
> > -}
> > -
> > /*
> > * Allocate a packet_data struct
> > */
> > @@ -567,10 +537,13 @@ static struct packet_data *pkt_alloc_packet_data(int frames)
> > goto no_pkt;
> >
> > pkt->frames = frames;
> > - pkt->w_bio = pkt_bio_alloc(frames);
> > + pkt->w_bio = bio_kmalloc(GFP_KERNEL, frames);
> > if (!pkt->w_bio)
> > goto no_bio;
> >
> > + pkt->w_bio->bi_end_io = pkt_end_io_packet_write;
> > + pkt->w_bio->bi_private = pkt;
> > +
> > for (i = 0; i < frames / FRAMES_PER_PAGE; i++) {
> > pkt->pages[i] = alloc_page(GFP_KERNEL|__GFP_ZERO);
> > if (!pkt->pages[i])
> > @@ -581,9 +554,12 @@ static struct packet_data *pkt_alloc_packet_data(int frames)
> > bio_list_init(&pkt->orig_bios);
> >
> > for (i = 0; i < frames; i++) {
> > - struct bio *bio = pkt_bio_alloc(1);
> > + struct bio *bio = bio_kmalloc(GFP_KERNEL, 1);
> > if (!bio)
> > goto no_rd_bio;
> > +
> > + bio->bi_end_io = pkt_end_io_read;
> > + bio->bi_private = pkt;
> > pkt->r_bios[i] = bio;
> > }
> >
> > @@ -1111,21 +1087,15 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
> > * Schedule reads for missing parts of the packet.
> > */
> > for (f = 0; f < pkt->frames; f++) {
> > - struct bio_vec *vec;
> > -
> > int p, offset;
> > +
> > if (written[f])
> > continue;
> > +
> > bio = pkt->r_bios[f];
> > - vec = bio->bi_io_vec;
> > - bio_init(bio);
> > - bio->bi_max_vecs = 1;
> > - bio->bi_sector = pkt->sector + f * (CD_FRAMESIZE >> 9);
> > - bio->bi_bdev = pd->bdev;
> > - bio->bi_end_io = pkt_end_io_read;
> > - bio->bi_private = pkt;
> > - bio->bi_io_vec = vec;
> > - bio->bi_destructor = pkt_bio_destructor;
> > + bio_reset(bio);
> > + bio->bi_sector = pkt->sector + f * (CD_FRAMESIZE >> 9);
> > + bio->bi_bdev = pd->bdev;
> >
> > p = (f * CD_FRAMESIZE) / PAGE_SIZE;
> > offset = (f * CD_FRAMESIZE) % PAGE_SIZE;
> > @@ -1418,14 +1388,9 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
> > }
> >
> > /* Start the write request */
> > - bio_init(pkt->w_bio);
> > - pkt->w_bio->bi_max_vecs = PACKET_MAX_SIZE;
> > + bio_reset(pkt->w_bio);
> > pkt->w_bio->bi_sector = pkt->sector;
> > pkt->w_bio->bi_bdev = pd->bdev;
> > - pkt->w_bio->bi_end_io = pkt_end_io_packet_write;
> > - pkt->w_bio->bi_private = pkt;
> > - pkt->w_bio->bi_io_vec = bvec;
> > - pkt->w_bio->bi_destructor = pkt_bio_destructor;
> > for (f = 0; f < pkt->frames; f++)
> > if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset))
> > BUG();
> > --
> > 1.7.7.3
> >
>
> --
> tejun
next prev parent reply other threads:[~2012-08-09 0:08 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 22:08 [PATCH v5 00/12] Block cleanups Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 02/12] dm: Use bioset's front_pad for dm_rq_clone_bio_info Kent Overstreet
[not found] ` <1344290921-25154-3-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:06 ` Tejun Heo
[not found] ` <20120808220612.GA6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-08 23:57 ` Kent Overstreet
[not found] ` <20120808235731.GA7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-11 5:24 ` Joseph Glanville
2012-08-13 21:44 ` Kent Overstreet
2012-08-19 11:46 ` Robert Kim App and Facebook Marketing
2012-08-14 5:33 ` Jun'ichi Nomura
[not found] ` <5029E320.3050603-JhyGz2TFV9J8UrSeD/g0lQ@public.gmane.org>
2012-08-15 20:46 ` Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 03/12] block: Add bio_reset() Kent Overstreet
[not found] ` <1344290921-25154-4-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:11 ` Tejun Heo
[not found] ` <20120808221129.GB6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 0:07 ` Kent Overstreet
[not found] ` <20120809000711.GB7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:00 ` Tejun Heo
[not found] ` <20120809060019.GA2845-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 6:06 ` Kent Overstreet
[not found] ` <20120809060640.GA9088-RcKxWJ4Cfj3IzGYXcIpNmNLIRw13R84JkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 6:30 ` Tejun Heo
2012-08-06 22:08 ` [PATCH v5 04/12] pktcdvd: Switch to bio_kmalloc() Kent Overstreet
[not found] ` <1344290921-25154-5-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:13 ` Tejun Heo
[not found] ` <20120808221359.GC6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 0:08 ` Kent Overstreet [this message]
2012-08-06 22:08 ` [PATCH v5 05/12] block: Kill bi_destructor Kent Overstreet
[not found] ` <1344290921-25154-6-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-07 3:19 ` Mike Snitzer
[not found] ` <20120807031921.GA31977-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-09 0:14 ` Kent Overstreet
2012-08-08 22:22 ` Tejun Heo
2012-08-09 0:21 ` Kent Overstreet
[not found] ` <20120809002154.GE7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:05 ` Tejun Heo
[not found] ` <20120809060517.GB2845-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 6:12 ` Kent Overstreet
[not found] ` <20120809061214.GA9128-RcKxWJ4Cfj3IzGYXcIpNmNLIRw13R84JkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 6:34 ` Tejun Heo
2012-08-15 22:19 ` Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 06/12] block: Add an explicit bio flag for bios that own their bvec Kent Overstreet
[not found] ` <1344290921-25154-7-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:28 ` Tejun Heo
[not found] ` <1344290921-25154-1-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-06 22:08 ` [PATCH v5 01/12] block: Generalized bio pool freeing Kent Overstreet
[not found] ` <1344290921-25154-2-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:25 ` Tejun Heo
2012-08-09 0:26 ` Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 07/12] block: Rename bio_split() -> bio_pair_split() Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 11/12] block: Add bio_clone_bioset() Kent Overstreet
[not found] ` <1344290921-25154-12-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 23:21 ` Tejun Heo
[not found] ` <20120808232120.GK6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 2:56 ` Kent Overstreet
[not found] ` <20120809025610.GK7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:52 ` Tejun Heo
[not found] ` <20120809065251.GD2845-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 6:59 ` Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 08/12] block: Introduce new bio_split() Kent Overstreet
[not found] ` <1344290921-25154-9-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 22:58 ` Tejun Heo
2012-08-09 1:19 ` Kent Overstreet
[not found] ` <20120809011928.GG7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:44 ` Tejun Heo
2012-08-13 21:55 ` Kent Overstreet
[not found] ` <20120813215511.GE9541-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-13 22:05 ` Tejun Heo
2012-08-08 23:05 ` Tejun Heo
[not found] ` <20120808230532.GH6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 1:39 ` Kent Overstreet
[not found] ` <20120809013923.GH7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 7:22 ` Tejun Heo
2012-08-09 7:33 ` Kent Overstreet
[not found] ` <20120809073334.GD9128-RcKxWJ4Cfj3IzGYXcIpNmNLIRw13R84JkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 17:32 ` Tejun Heo
[not found] ` <20120809173217.GA6644-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-13 22:09 ` Kent Overstreet
2012-08-06 22:08 ` [PATCH v5 09/12] block: Rework bio_pair_split() Kent Overstreet
[not found] ` <1344290921-25154-10-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 23:09 ` Tejun Heo
2012-08-06 22:08 ` [PATCH v5 10/12] block: Add bio_clone_kmalloc() Kent Overstreet
[not found] ` <1344290921-25154-11-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-08 23:15 ` Tejun Heo
[not found] ` <20120808231552.GJ6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-09 1:57 ` Kent Overstreet
[not found] ` <20120809015704.GI7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:55 ` Tejun Heo
2012-08-09 7:02 ` Kent Overstreet
2012-08-09 2:38 ` [PATCH] Consolidate bio_clone_bioset(), bio_kmalloc() Kent Overstreet
[not found] ` <20120809023811.GJ7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 6:56 ` Tejun Heo
2012-08-06 22:08 ` [PATCH v5 12/12] block: Only clone bio vecs that are in use Kent Overstreet
[not found] ` <1344290921-25154-13-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-08-06 23:16 ` [dm-devel] " Mikulas Patocka
[not found] ` <Pine.LNX.4.64.1208061913500.21956-e+HWlsje6Db1wF9wiOj0lkEOCMrvLtNR@public.gmane.org>
2012-08-08 23:28 ` Tejun Heo
[not found] ` <20120808232804.GL6983-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-08 23:47 ` Muthu Kumar
[not found] ` <CAFR8uedZiG0NWgWQQa03r+kKh8rT0jzpj+hwPzq+i7K6zhpT_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-09 3:19 ` Kent Overstreet
[not found] ` <20120809031936.GM7262-jC9Py7bek1znysI04z7BkA@public.gmane.org>
2012-08-09 3:25 ` Kent Overstreet
2012-08-10 1:50 ` Muthu Kumar
2012-08-09 7:01 ` Tejun Heo
[not found] ` <20120809070154.GG2845-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-08-10 2:29 ` Muthu Kumar
2012-08-08 23:30 ` Tejun Heo
2012-08-09 3:06 ` Kent Overstreet
2012-08-09 17:37 ` Tejun Heo
2012-08-13 21:46 ` Kent Overstreet
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=20120809000850.GC7262@moria.home.lan \
--to=koverstreet-hpiqsd4aklfqt0dzr+alfa@public.gmane.org \
--cc=agk-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=drbd-dev-cunTk1MwBs8qoQakbn7OcQ@public.gmane.org \
--cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mpatocka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=neilb-l3A5Bk7waGM@public.gmane.org \
--cc=petero2-zq6IREYz3ykAvxtiuMwx3w@public.gmane.org \
--cc=sage-BnTBU8nroG7k1uMJSBkQmQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=yehuda-L5o5AL9CYN0tUFlbccrkMA@public.gmane.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).