Re: Basic doubt regarding block layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Jun 29, 2010 at 9:33 PM, Michael Blizek
<michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi!
>
> On 11:00 Tue 29 Jun     , Sudheer wrote:
>> One basic doubt regarding block layer & write system call. When a
>> process writes to a file in blocking mode, when the 'write' system
>> call returns,
>>
>> A. will the process be returned only after actually writing the data
>> on to the target block device? In this case we will get the benefit of
>> elevator only if multiple processes are writing to the adjacent
>> locations in the device. Is this true?
>
> Usually not, but you might get this behaviour by specifying the mount option
> "sync" on some file systems.
>
>>
>>
>> OR
>>
>> B. will the process be returned after scheduling the writing (say
>> after passing the data to the elevator)?
>
> Yes, this is what usually happens.
>
>> If this case is true, how
>> would the process ensure that the data has been actually written on to
>> the block device?
>
> By calling fsync() .


Thanks for the comments. In this case, is there any difference in
invoking 'write' with O_NONBLOCK flag set and without O_NONBLOCK?.

>From the man page it looks like that the O_NONBLOCK is used to
determine whether or not to block the process if it tries to access a
'locked' region. Means it doesn't have any effect in 'write' system
call?


-- 
Thanks
Sudheer

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux