All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] drbd uses wrong API for struct bio
@ 2005-01-23 16:16 Lars Marowsky-Bree
  2005-01-24  8:24 ` [Drbd-dev] " Jens Axboe
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Lars Marowsky-Bree @ 2005-01-23 16:16 UTC (permalink / raw)
  To: drbd-dev; +Cc: axboe


[-- Attachment #1.1: Type: text/plain, Size: 873 bytes --]

Hi all,

drbd is a quite bad offender for using bio's on stack or embedded in
other internal structs instead of the pointer interface.

The attached patch shows the 'right' way as an example, which was pretty easy
because I could use Jens' patch for md with minimal modifications ;-) However,
the other offending code lines are within the transfer log and other places,
and I'm not sure Philipp wants me to mess around with that.

Jens, on chip.suse.de:/local/lmb/drbd-07/drbd/ you can find the most recent
drbd kernel code. Could you look over drbd_compat_wrappers.h line 326ff in
particular and give me a rough rundown of what's broken? We need to fix this by
Tuesday latest :-(


Sincerely,
    Lars Marowsky-Brée <lmb@suse.de>

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business


[-- Attachment #1.2: drbd-bio-on-stack --]
[-- Type: text/plain, Size: 1366 bytes --]

Index: drbd/drbd_actlog.c
===================================================================
--- drbd/drbd_actlog.c	(revision 1730)
+++ drbd/drbd_actlog.c	(working copy)
@@ -64,35 +64,29 @@
 STATIC int _drbd_md_sync_page_io(drbd_dev *mdev, struct page *page, 
 				 sector_t sector, int rw, int size)
 {
-	struct bio bio;
-	struct bio_vec vec;
+	struct bio *bio = bio_alloc(GFP_KERNEL, 1);
 	struct completion event;
 	int ok;
 
-	bio_init(&bio);
-	bio.bi_io_vec = &vec;
-	vec.bv_page = page;
-	vec.bv_offset = 0;
-	vec.bv_len =
-	bio.bi_size = size;
-	bio.bi_vcnt = 1;
-	bio.bi_idx = 0;
-	bio.bi_bdev = mdev->md_bdev;
-	bio.bi_sector = sector;
+	bio_get(bio);
+
+	bio->bi_bdev = mdev->md_bdev;
+	bio->bi_sector = sector;
+	bio_add_page(bio, page, size, 0);
 	init_completion(&event);
-	bio.bi_private = &event;
-	bio.bi_end_io = drbd_md_io_complete;
+	bio->bi_private = &event;
+	bio->bi_end_io = drbd_md_io_complete;
 
 #ifdef BIO_RW_SYNC
-	submit_bio(rw | (1 << BIO_RW_SYNC), &bio);
+	submit_bio(rw | (1 << BIO_RW_SYNC), bio);
 #else
-	submit_bio(rw, &bio);
+	submit_bio(rw, bio);
 	drbd_blk_run_queue(bdev_get_queue(mdev->md_bdev));
 #endif
 	wait_for_completion(&event);
 
-	ok = test_bit(BIO_UPTODATE, &bio.bi_flags);
-
+	ok = test_bit(BIO_UPTODATE, &bio->bi_flags);
+	bio_put(bio);
 	return ok;
 }
 #endif

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2005-01-26 11:15 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23 16:16 [Drbd-dev] drbd uses wrong API for struct bio Lars Marowsky-Bree
2005-01-24  8:24 ` [Drbd-dev] " Jens Axboe
2005-01-24 12:32   ` Helmut Wollmersdorfer
2005-01-24 12:35     ` Lars Marowsky-Bree
2005-01-24  9:10 ` Jens Axboe
2005-01-24  9:28   ` Lars Marowsky-Bree
2005-01-24  9:58   ` Lars Marowsky-Bree
2005-01-24 10:23     ` Jens Axboe
2005-01-24 10:28       ` Lars Marowsky-Bree
2005-01-24 12:24         ` Lars Marowsky-Bree
2005-01-24 12:52           ` Lars Marowsky-Bree
2005-01-24 14:29         ` Philipp Reisner
2005-01-26 11:15         ` Lars Ellenberg
2005-01-24 14:27     ` Philipp Reisner
2005-01-24 14:27 ` [Drbd-dev] " Philipp Reisner
2005-01-24 14:37   ` Lars Marowsky-Bree
2005-01-24 14:38 ` Philipp Reisner
2005-01-24 14:41   ` Lars Marowsky-Bree
2005-01-24 20:46     ` Lars Marowsky-Bree
2005-01-24 23:23 ` [Drbd-dev] [fix] " Lars Marowsky-Bree
2005-01-25  9:26   ` Philipp Reisner
2005-01-25  9:39     ` Jens Axboe
2005-01-25  9:58       ` Philipp Reisner
2005-01-25 10:05         ` Lars Marowsky-Bree
2005-01-25 11:44           ` Philipp Reisner
2005-01-25  9:53     ` Lars Marowsky-Bree

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.