Re: [PATCH 3/8] block,ide: simplify bdops->set_capacity() to ->unlock_native_capacity()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bartlomiej Zolnierkiewicz
Date: Saturday, May 15, 2010 - 11:48 am

Hi Tejun,

On Saturday 15 May 2010 08:09:29 pm Tejun Heo wrote:

This seems to rely on an optimistic assumption that command execution
will always be successful and that no errors on disk or host level can
ever happen..

[ The assumption in question was introduced in the previous patch:

@@ -605,14 +604,11 @@ try_scan:
                        if (bdops->set_capacity &&
                            (disk->flags & GENHD_FL_NATIVE_CAPACITY) == 0) {
                                printk(KERN_CONT "enabling native capacity\n");
-                               capacity = bdops->set_capacity(disk, ~0ULL);
+                               bdops->set_capacity(disk, ~0ULL);
                                disk->flags |= GENHD_FL_NATIVE_CAPACITY;
-                               if (capacity > get_capacity(disk)) {
-                                       set_capacity(disk, capacity);
-                                       check_disk_size_change(disk, bdev);
-                                       bdev->bd_invalidated = 0;
-                               }
-                               goto try_scan;
+                               /* free state and restart */
+                               kfree(state);
+                               goto rescan;

originally if the command execution failed the 'capacity' would be 0 ]

It also seems that the original code could be improved a lot to handle
(very unlikely but not impossible) error situations better..

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 3/8] block,ide: simplify bdops->set_capacity() ..., Bartlomiej Zolnierki ..., (Sat May 15, 11:48 am)
Re: [PATCH 8/8] libata: implement on-demand HPA unlocking, David Miller, (Sun May 16, 12:19 am)
Re: [PATCH 6/8] SCSI: implement sd_unlock_native_capacity(), James Bottomley, (Sun May 16, 6:39 am)
Re: [PATCH 6/8] SCSI: implement sd_unlock_native_capacity(), James Bottomley, (Sun May 16, 9:00 am)
Re: [PATCH 6/8] SCSI: implement sd_unlock_native_capacity(), James Bottomley, (Sun May 16, 12:23 pm)