All of lore.kernel.org
 help / color / mirror / Atom feed
* Block device API
@ 2006-01-25  2:58 Joshua Hudson
  2006-01-25  3:17 ` Fawad Lateef
  0 siblings, 1 reply; 4+ messages in thread
From: Joshua Hudson @ 2006-01-25  2:58 UTC (permalink / raw)
  To: linux-kernel

I am working on a kernel filesystem driver. I have found plenty of
documentation on
how to communicate between the VFS and the filesystem driver, but nothing
on how to communicate between the block device and the filesystem driver.

I found sb_bread() but there is no corrisponding sb_bwrite().
I presume that if ((struct superblock *)s) -> bdev is the block
device handle, but I cannot find the read/write pair of functions.

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

* Re: Block device API
  2006-01-25  2:58 Block device API Joshua Hudson
@ 2006-01-25  3:17 ` Fawad Lateef
  2006-01-25  8:37   ` Coywolf Qi Hunt
  0 siblings, 1 reply; 4+ messages in thread
From: Fawad Lateef @ 2006-01-25  3:17 UTC (permalink / raw)
  To: Joshua Hudson; +Cc: linux-kernel

On 1/25/06, Joshua Hudson <joshudson@gmail.com> wrote:
> I am working on a kernel filesystem driver. I have found plenty of
> documentation on
> how to communicate between the VFS and the filesystem driver, but nothing
> on how to communicate between the block device and the filesystem driver.
>

AFAIK there isn't any documentation/article for block and filesystem
layer interaction (or till now me also not able to find any) :)

> I found sb_bread() but there is no corrisponding sb_bwrite().
> I presume that if ((struct superblock *)s) -> bdev is the block
> device handle, but I cannot find the read/write pair of functions.
> -

sb_bread is the function used for reading a block (especially
superblock) from the storage. For reading/writing do look at
generic_file_read/write functions found in mm/filemap.c and when going
through the code you will see its ends up in calling
mappings->a_ops->readpage(s)/writepage(s) of filesystem in which
normal filesystems (like ext2) just call function
mpage_readpages/writepages found in fs/mpage.c which performs actual
read/write on the block device.

I hope this helps !

--
Fawad Lateef

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

* Re: Block device API
  2006-01-25  3:17 ` Fawad Lateef
@ 2006-01-25  8:37   ` Coywolf Qi Hunt
  2006-01-25  9:27     ` Fawad Lateef
  0 siblings, 1 reply; 4+ messages in thread
From: Coywolf Qi Hunt @ 2006-01-25  8:37 UTC (permalink / raw)
  To: Fawad Lateef; +Cc: Joshua Hudson, linux-kernel

On Wed, Jan 25, 2006 at 08:17:02AM +0500, Fawad Lateef wrote:
> On 1/25/06, Joshua Hudson <joshudson@gmail.com> wrote:
> > I am working on a kernel filesystem driver. I have found plenty of
> > documentation on
> > how to communicate between the VFS and the filesystem driver, but nothing
> > on how to communicate between the block device and the filesystem driver.
> >
> 
> AFAIK there isn't any documentation/article for block and filesystem
> layer interaction (or till now me also not able to find any) :)
> 
> > I found sb_bread() but there is no corrisponding sb_bwrite().
> > I presume that if ((struct superblock *)s) -> bdev is the block
> > device handle, but I cannot find the read/write pair of functions.
> > -
> 
> sb_bread is the function used for reading a block (especially
> superblock) from the storage. For reading/writing do look at

Does __bread() contribute to page cache? I think not. And we don't
care the work done by __bread().

> generic_file_read/write functions found in mm/filemap.c and when going
> through the code you will see its ends up in calling
> mappings->a_ops->readpage(s)/writepage(s) of filesystem in which
> normal filesystems (like ext2) just call function
> mpage_readpages/writepages found in fs/mpage.c which performs actual
> read/write on the block device.
-- 
Coywolf Qi Hunt

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

* Re: Block device API
  2006-01-25  8:37   ` Coywolf Qi Hunt
@ 2006-01-25  9:27     ` Fawad Lateef
  0 siblings, 0 replies; 4+ messages in thread
From: Fawad Lateef @ 2006-01-25  9:27 UTC (permalink / raw)
  To: Coywolf Qi Hunt; +Cc: Joshua Hudson, linux-kernel

On 1/25/06, Coywolf Qi Hunt <qiyong@fc-cn.com> wrote:
> On Wed, Jan 25, 2006 at 08:17:02AM +0500, Fawad Lateef wrote:
> >
> > AFAIK there isn't any documentation/article for block and filesystem
> > layer interaction (or till now me also not able to find any) :)
> >
> >
> > sb_bread is the function used for reading a block (especially
> > superblock) from the storage. For reading/writing do look at
>
> Does __bread() contribute to page cache? I think not. And we don't
> care the work done by __bread().
>

Ya, __bread() directly sends read request to the block device without
involvement of buffer cache ! Is there any point In my explaination in
which I mentioned __bread related to buffer_cache ? if yes then its a
mistake .... and __bread is direct function which calls submit_bh and
waits for its completion.

--
Fawad Lateef

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

end of thread, other threads:[~2006-01-25  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-25  2:58 Block device API Joshua Hudson
2006-01-25  3:17 ` Fawad Lateef
2006-01-25  8:37   ` Coywolf Qi Hunt
2006-01-25  9:27     ` Fawad Lateef

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.