Re: Directly using a logical volume

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

 



/ 2005-09-21 13:23:40 -0400
\ Allen, Jack:
> From: Lars Ellenberg [mailto:Lars.Ellenberg@linbit.com] 
> Sent: Wednesday, September 21, 2005 8:58 AM
> / 2005-09-20 16:14:25 -0400
> \ Allen, Jack:
> >         I have a system connected to a SAN via Fibre Channel interface.
> > The system sees 3 disk sdb, sdc and sdd. I put them in a volume group
> > and then allocated some logical volumes. If I use the logical volume to
> > read and write to directly for my application, if there is an error on a
> > write, I assume the write system call will return an error. Or does the
> > write give a good return value after putting the data in some system
> > buffer to be written later? Then is the write of the system buffer fails
> > later, my program would not know.
> 
> not exactly a linux-lvm question, is it?
> 
> man 2 write
> man 2 fsync
> man 3 open       (O_SYNC)

> I have read the man pages and that would be "man 2 open". The O_SYNC seems

man 3 open happened to be the open (POSIX) man page here.

> to only work for a regular file not a block device as the logical volume is.

to the best of my knowledge, the O_SYNC works on block devices, too.

> This was part of the reason for my questions. On UNIX systems we use the
> character device name and the O_SYNC does what you think it would there.

there is also O_DIRECT, which might be more what you want to use.
and there is the "raw" interface, too
(which is deprecated, afaik, at least in 2.6 kernels, where you should
use O_DIRECT instead).

> I
> know this is Linux and some things are different. Again the reason for my
> questions. And yes it could be a linux-lvm question if the block device
> presented by LVM works differently than a true SCSI block device. Again the
> reason for the questions.

did not mean to offend you.
this is all abstracted in the generic block device layer,
so it does not make a difference whether it is ide/sata/scsi/lvm.

I'd recommend you use O_DIRECT|O_SYNC, then.
note that this implies buffer allignment restrictions.

this should just work as described by you.
still it probably does not hurt to have fsync in the code where appropriate.

cheers,

-- 
: Lars Ellenberg                                  Tel +43-1-8178292-0  :
: LINBIT Information Technologies GmbH            Fax +43-1-8178292-82 :
: Schoenbrunner Str. 244, A-1120 Vienna/Europe   http://www.linbit.com :

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux