Re: [PATCH V2] Btrfs: Full direct I/O and AIO read implementation.

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

 



On Mon, Feb 15, 2010 at 05:40:54PM -0500, jim owens wrote:
> Christoph Hellwig wrote:
> >On Mon, Feb 15, 2010 at 05:26:34PM -0500, jim owens wrote:
> >>My understanding is the current 4k drives normally operate in
> >>512 byte read/write access mode unless you set them to run
> >>as 4k only.
> >>
> >>In 512 byte mode, they buffer internally on writes.  It is probably
> >>just as safe as any other drive on a power hit, as in anything may
> >>be trash.
> >>
> >>btrfs read of 512 byte boundaries is safe because we only write
> >>in 4k boundaries (hopefully we can detect and align on the drive).
> >
> >There are drives that still have 512 byte logical, but 4k physical
> >blocks, this includes all the consumer (SATA) drives.  You can also
> >have drives with 4k physical and logical block size, this includes
> >many S/390 DASD devices, and also samples of enterprise SAS drives.
> >
> >The logical block size is the addressing limit for the OS, so your
> >above scenario is correct for the 512 bye logical / 4k physical
> >devices, but not the 4k logical / 4k physical devices.  Nevermind
> >other corner cases like 2k block size CD-ROM which could in theory
> >be used in a read-only btrfs filesystem (very unlikely, but..).
> >
> >So no, you really can't go under the bdev_logical_block_size()
> >advertized by the device, and that may as well be over 512 bytes.
> 
> I agree fully with all of that.  What I did not say is the
> current btrfs direct IO code does not go below the drive
> logical block size.  If the drive says 4k and the user tries
> to read any other multiple, the code returns an error.
> 
> The confusion is that detection occurs only when I go to
> build the bio because it is there that I know the drive
> and extract the drive block size to check alignment.
> 
> We only know what drive is being used when we have the
> extent info because we can have multiple drives in btrfs.
> 
> The early 512 check is the idiot check.

The 512 check just needs to be replaced with a number that we store
during device scan.  We won't try to bend physics w/4k drives ;)

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux