mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* b_dev vs. b_rdev confusion
@ 2001-06-19 18:11 tpepper
  2001-06-19 18:25 ` Tim Pepper
  0 siblings, 1 reply; 3+ messages in thread
From: tpepper @ 2001-06-19 18:11 UTC (permalink / raw)
  To: linux-kernel

These are probably dumb questions but I haven't been able to find
definitive answers...

Is there a set rule on when/where one should use a buffer head's b_dev
and when/where one should use b_rdev?

I'm been tracing through the kernel source quite a bit and it seems like
above ll_rw_blk.c's submit_bh() b_dev is being used.  Below there as the
request heads off into whichever block device b_rdev is used.  Is this
true?  Things read like the b_dev/b_rdev distinction was introduced to
facilitate block drivers intercepting and redirecting requests (lvm,
raid, multipathing, &tc.) and I'm trying to figure out if there's a
clean delineation of which is used where and if I can safely twiddle
b_rdev and pass the buffer head on without copying it.  (Are these what are
somtimes called "stacking drivers" here?)

All of the md code looks like it copies the buffer head, setting
b_dev=b_rdev="real device" in the new bh and leaving b_dev==b_rdev="logical
device" in the original bh.  I'm assuming they do this for a reason, but
it would be nice from a performance standpoint to just touch b_rdev and
b_end_io and be done.  Is there something I'm missing which necessitates the
copy?

And how do the inode->i_dev, i_rdev and i_bdev fit into this?  When are those
set and does anything get confused by i_rdev moving?

Thanks in advance for any suggestions/info...

Tim

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: b_dev vs. b_rdev confusion
@ 2001-06-19 18:55 Andries.Brouwer
  0 siblings, 0 replies; 3+ messages in thread
From: Andries.Brouwer @ 2001-06-19 18:55 UTC (permalink / raw)
  To: linux-kernel, tpepper

> how do the inode->i_dev, i_rdev fit into this?

These are what you see with stat(2).
i_dev gives the device the file is on
i_rdev is usually undefined, but for device special files
it gives the real device.

> Is there a set rule on when/where one should use a buffer head's
> b_dev and when/where one should use b_rdev?

b_dev gives the device the user was thinking about
b_rdev is the actual underlying device

Andries

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

end of thread, other threads:[~2001-06-19 18:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-19 18:11 b_dev vs. b_rdev confusion tpepper
2001-06-19 18:25 ` Tim Pepper
2001-06-19 18:55 Andries.Brouwer

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®