Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56502
b: refs/heads/master
c: 6ddcd3b
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed May 16, 2007
1 parent 8bf8072 commit a683bc6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fe30911b34098db58c21d0f936f6c3f17f32deb8
refs/heads/master: 6ddcd3b0201a7ad72294347636d2b4028ddbd95d
33 changes: 15 additions & 18 deletions trunk/drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,6 @@ int ata_dev_configure(struct ata_device *dev)
snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id));

dev->n_sectors = ata_id_n_sectors(id);
dev->n_sectors_boot = dev->n_sectors;

/* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
Expand Down Expand Up @@ -3632,7 +3631,6 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
const u16 *old_id = dev->id;
unsigned char model[2][ATA_ID_PROD_LEN + 1];
unsigned char serial[2][ATA_ID_SERNO_LEN + 1];
u64 new_n_sectors;

if (dev->class != new_class) {
ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n",
Expand All @@ -3644,7 +3642,6 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
ata_id_c_string(new_id, model[1], ATA_ID_PROD, sizeof(model[1]));
ata_id_c_string(old_id, serial[0], ATA_ID_SERNO, sizeof(serial[0]));
ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1]));
new_n_sectors = ata_id_n_sectors(new_id);

if (strcmp(model[0], model[1])) {
ata_dev_printk(dev, KERN_INFO, "model number mismatch "
Expand All @@ -3658,19 +3655,6 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
return 0;
}

if (dev->class == ATA_DEV_ATA && dev->n_sectors != new_n_sectors) {
ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
"%llu != %llu\n",
(unsigned long long)dev->n_sectors,
(unsigned long long)new_n_sectors);
/* Are we the boot time size - if so we appear to be the
same disk at this point and our HPA got reapplied */
if (ata_ignore_hpa && dev->n_sectors_boot == new_n_sectors
&& ata_id_hpa_enabled(new_id))
return 1;
return 0;
}

return 1;
}

Expand Down Expand Up @@ -3723,6 +3707,7 @@ int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags)
*/
int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
{
u64 n_sectors = dev->n_sectors;
int rc;

if (!ata_dev_enabled(dev))
Expand All @@ -3735,8 +3720,20 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)

/* configure device according to the new ID */
rc = ata_dev_configure(dev);
if (rc == 0)
return 0;
if (rc)
goto fail;

/* verify n_sectors hasn't changed */
if (dev->class == ATA_DEV_ATA && dev->n_sectors != n_sectors) {
ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
"%llu != %llu\n",
(unsigned long long)n_sectors,
(unsigned long long)dev->n_sectors);
rc = -ENODEV;
goto fail;
}

return 0;

fail:
ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc);
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ struct ata_device {
struct scsi_device *sdev; /* attached SCSI device */
/* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
u64 n_sectors; /* size of device, if ATA */
u64 n_sectors_boot; /* size of ATA device at startup */
unsigned int class; /* ATA_DEV_xxx */
u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
u8 pio_mode;
Expand Down

0 comments on commit a683bc6

Please sign in to comment.