Re: [PATCH v2] libata: fix ata_id_logical_per_physical_sectors

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

 



Jeff, ping?  Without this patch the minimum I/O size for 4k drives will
be reported incorrectly, which will make paritions misaligned on modern
distros.

On Thu, Jan 28, 2010 at 01:30:11PM +0100, Christoph Hellwig wrote:
> The value we get from the low byte of the ATA_ID_SECTOR_SIZE word is not not
> a plain multiple, but the log of it, so fix the helper to give the correct
> answer.  Without this we'll get an incorrect minimal I/O size in the block
> limits VPD page for 4k sector drives.
> 
> Also change the return value of ata_id_logical_per_physical_sectors to u16
> for the unlikely case of very large logical sectors.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 
> Index: linux-2.6/include/linux/ata.h
> ===================================================================
> --- linux-2.6.orig/include/linux/ata.h	2010-01-28 12:24:02.061016474 +0100
> +++ linux-2.6/include/linux/ata.h	2010-01-28 13:26:59.270005271 +0100
> @@ -647,9 +647,9 @@ static inline int ata_id_has_large_logic
>  	return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
>  }
>  
> -static inline u8 ata_id_logical_per_physical_sectors(const u16 *id)
> +static inline u16 ata_id_logical_per_physical_sectors(const u16 *id)
>  {
> -	return id[ATA_ID_SECTOR_SIZE] & 0xf;
> +	return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf);
>  }
>  
>  static inline int ata_id_has_lba48(const u16 *id)
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux