mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jochen Oekonomopulos <jochen.oekonomopulos@uni-konstanz.de>
To: linux-kernel@vger.kernel.org
Subject: bio -> bi_bdev
Date: Wed, 24 Jan 2007 14:46:19 +0100	[thread overview]
Message-ID: <1169646379.45b7632be1cb1@webmail.uni-konstanz.de> (raw)


Hello,

I am working on a module to redirect a bio request from one block device
to another. Therefore, I catch every bio from one device, clone it and
change the underlying block_device bi_bdev to the other block device.
Everything works fine, except that the first page read is always filled
with random data. Everything else works fine. So I am wondering, if
there is something I did not take into consideration.

I tested it under 2.6.8 and 2.6.19 with the same results.

Below is the essence of my redirection code.


"device" is the instance of my device structure. The original read was
made to it and I want to redirect it to the block_device linked in
bdev.

struct bio bio, cloned_bio;
int sect = 0;


rq_for_each_bio(bio, req) {
		
		cloned_bio = bio_clone(bio, GFP_NOIO);
		cloned_bio -> bi_private = bio;
		cloned_bio -> bi_bdev = device -> bdev;
		
		if(bio_data_dir(cloned_bio) == WRITE) {

			submit_bio(WRITE, cloned_bio);
		}
		else {

			submit_bio(READ, cloned_bio);
		}
		
		sect += cloned_bio->bi_size/KERNEL_SECTOR_SIZE;

	}

thanks in advance for any feedback,

Jochen Oekonomopulos

                 reply	other threads:[~2007-01-24 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1169646379.45b7632be1cb1@webmail.uni-konstanz.de \
    --to=jochen.oekonomopulos@uni-konstanz.de \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®