Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 1997 22:28:38 -0800
From:      Julian Elischer <julian@whistle.com>
To:        Terry Lambert <terry@lambert.org>
Cc:        Simon Shapiro <Shimon@i-Connect.Net>, freebsd-hackers@freebsd.org
Subject:   Re: Raw I/O Question
Message-ID:  <33016316.41C67EA6@whistle.com>
References:  <199702112244.PAA29164@phaeton.artisoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert wrote:
> 
> > Can someone take a moment and describe briefly the execution path of a
> > lseek/read/write system call to a raw (character) SCSI partition?

> 
> You skipped a specification step: the FS layout on that partition.
> I will assume FFS with 8k block size (the default).

Terry, in your description you forget he's asking for
RAW devices..

>
>         -> read syscall
>         -> fill out uio struct
>         -> call VOP_READ using bogus fileops struct dereference
>            which is there because named pipes and UNIX domain
>            sockets aren't in the VFS like they should be
>         -> ffs_read (/sys/ufs/ufs/ufs_readwrite.c:READ)
>         -> (called iteratively)
>                 bread
>                 -> getblk
>                    (in cache?  No?)
>                    -> vfs_busy_pages
>                       VOP_STRATEGY
>                       -> VCALL strategy routine for device vnode
>                       -> spec_strategy (/sys/miscfs/specfs/spec_vnops.c)
>                       -> call device strategy through bdevsw[]
>                       -> generic scsi (scbus [bus interface]/sd [disk
>                          interface]
>                       -> actual controller requests
>                       biowait
>                 uiomove
>                 -> copyout
> 
for a raw device..
raw_read()
calls physio,
which faults in and wires down pages in the user space
for the buffer (in case they are out)
then it takes the phyical addresses
and applies them to a reerved section of kernel VM space.
it then calls the strategy routine for the device
which gets the kv region, 
and extracts the phyical addresses again and 
sets up the DMA
and then waits

DMA is directly into the users pages..

> write
>         -> write syscall
>         -> fill out uio struct
>         -> call VOP_WRITE using bogus fileops struct dereference
>            which is there because named pipes and UNIX domain
>            sockets aren't in the VFS like they should be
>         -> ffs_write (/sys/ufs/ufs/ufs_readwrite.c:WRITE)
>         -> (called iteratively)
>                 (partial FS block? !!!CALL READ!!!
>                 -> fill in modified areas of partial FS block
>                    (uiomove)
>                    -> copyin

nope.. not in raw devices.

>                 bwrite
>         ...
d



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33016316.41C67EA6>