linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lars Ellenberg <Lars.Ellenberg@linbit.com>
To: linux-lvm@redhat.com
Subject: Re: [linux-lvm] Directly using a logical volume
Date: Wed, 21 Sep 2005 22:54:02 +0200	[thread overview]
Message-ID: <20050921205402.GG16203@barkeeper1.linbit> (raw)
In-Reply-To: <C28DB247D333BC47BBAAFDC914DE39010261F5DE@atlexc07ntms.mckesson.com>

/ 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 :

  reply	other threads:[~2005-09-21 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 17:23 [linux-lvm] Directly using a logical volume Allen, Jack
2005-09-21 20:54 ` Lars Ellenberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-20 20:14 Allen, Jack
2005-09-21 12:58 ` Lars Ellenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050921205402.GG16203@barkeeper1.linbit \
    --to=lars.ellenberg@linbit.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).