Re: How to know the file size limit, and know if O_DIRECT is supported

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

 



Hi Erik,
My colleague said that when use direct I/O on USB disk that has a ext3
partition, open can succeed, but read fails.
I know that filesystem must have some system calls for direct I/O, and open
with O_DIRECT flag will check if these system calls exist.
But why does read fail? Is it that direst I/O cannot use on USB disk?

Regards,
Colin



----- Original Message ----- 
From: "Erik Mouw" <mouw@xxxxxxxxxxxx>
To: "colin" <colin@xxxxxxxxxxxxxx>
Cc: <kernelnewbies@xxxxxxxxxxxx>
Sent: Thursday, December 21, 2006 9:37 PM
Subject: Re: How to know the file size limit, and know if O_DIRECT is
supported


> On Thu, Dec 21, 2006 at 04:40:03PM +0800, colin wrote:
> > How do I know the file size limit on a unknown filesystem?
> > Our application can use CIFS and record data to the remote site.
> > We would like to know the file size limit before we start to record, but
the
> > "fstat" doesn't tell us about this.
>
> AFAIK there is no system call to figure out though the information is
> in the (in-kernel) superblock. One way is to create a file and use a
> binary search with ftruncate() to figure out the largest possible size.
> That will only work fast on filesystems that support sparse files.
> Another way is to use a safe limit (i.e.: 1GB is usually safe).
>
> > And another question is how do I know if Direct I/O is usable on some
> > filesystem and storage?
>
> open() a file with O_DIRECT. If it fails, direct IO is not possible.
>
>
> Erik
>
> -- 
> They're all fools. Don't worry. Darwin may be slow, but he'll
> eventually get them. -- Matthew Lammers in alt.sysadmin.recovery


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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