Linux-kernel mailing list archive 1998-49,: Re: Concurrent read/writes on the same file

# Re: Concurrent read/writes on the same file

Stephen C. Tweedie (sct@redhat.com)
Tue, 8 Dec 1998 12:26:53 GMT

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Stephen C. Tweedie: "Re: inconsistent performance for 2 partitions on the same disk"
- Previous message: Helge Hafting: "Re: [LITTLE BIT OFFTOPIC] Re: crypto"
- In reply to: HARAWAT.IN.ORACLE.COM: "Concurrent read/writes on the same file"
- Next in thread: Chris Wedgwood: "Re: Concurrent read/writes on the same file"
- Reply: Chris Wedgwood: "Re: Concurrent read/writes on the same file"
- Reply: Stephen C. Tweedie: "Re: Concurrent read/writes on the same file"

Hi,

On 07 Dec 98 20:38:42 +0330, "HARAWAT.IN.ORACLE.COM"
<HARAWAT.IN.oracle.com.ofcmail@in.oracle.com> said:

> In FreeBSD the vn_read function looks like this
> lock the vnode
> do the actual read
> unlock the vnode
> So it means that one read/write will execute in the kernel at one
> point of time, the second read/write will block while trying to lock
> the vnode. Is the same algo used in Linux also.

No. In Linux, writes are locked in this way, but only while we
are copying the user data into the kernel writeback buffers. Once the
write() system call is complete, we drop the lock and perform the data
write asynchronously. Reads are not locked.

> Is the same algo used for the Raw Devices as well.

No, the raw device implementation I'm currently finishing off for 2.1
does not lock the IO regions at all. It _does_ lock the user's IO
buffer, so you cannot perform concurrent writes from the same buffer to
different areas of disk, but you can safely submit multiple outstanding
IOs from different buffers.

The existing (non-raw) block devices on Linux do not lock at all.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Stephen C. Tweedie: "Re: inconsistent performance for 2 partitions on the same disk"
- Previous message: Helge Hafting: "Re: [LITTLE BIT OFFTOPIC] Re: crypto"
- In reply to: HARAWAT.IN.ORACLE.COM: "Concurrent read/writes on the same file"
- Next in thread: Chris Wedgwood: "Re: Concurrent read/writes on the same file"
- Reply: Chris Wedgwood: "Re: Concurrent read/writes on the same file"
- Reply: Stephen C. Tweedie: "Re: Concurrent read/writes on the same file"