Re: [PATCH] Forcing capacity sizes for block devices

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

 



On Monday 21 December 2009 09:04:03 pm Grant Grundler wrote:
> On Sun, Dec 20, 2009 at 9:43 AM, Bartlomiej Zolnierkiewicz
> <bzolnier@xxxxxxxxx> wrote:
> > On Sunday 20 December 2009 01:05:35 pm Clemens Fruhwirth wrote:
> >> Make the size attribute of block devices writable via sysfs. This
> >> allows userspace to force
> >> device boundaries in cases where the device driver is unable to detect
> >> the correct size, as
> >> with spec-incompliant SD card readers. Also see
> >> http://marc.info/?t=125555550200010&r=1&w=2
> >
> > Just a wild idea but maybe the current block infrastructure for handling
> > ATA HPA (see commit db429e9 and e957b60 one) can be used to automatically
> > detect and workaround the issue?
> 
> Are you referring to this change?
> +       libata.ignore_hpa=      [LIBATA] Ignore HPA limit
> +                       libata.ignore_hpa=0       keep BIOS limits (default)
> +                       libata.ignore_hpa=1       ignore limits, using full disk

Nah.

> My git-foo isn't very good...what command will display the two changes
> you refer to above?

git log -p --color db429e9^1..e957b60

We should be able to detect working SD reader/card combination in sd
driver's ->set_capacity method implementation (i.e. by issuing read
request for the last partitioned sector outside of the reported device
capacity) during the initial partition table scan and at the same time
adjust the device capacity used by the kernel if necessary.

New/empty cards would still need to be 'force partitioned' first using
fdisk (or sfdisk if fdisk doesn't allow such operation) but after it's
done the partition rescan on fdisk's exit will recognize new device's
capacity automatically..

> about b0rked HW, the user (or udev maybe?) can workaround this issue.
> Given how simple the patch, I don't see any reason to reject it.

Simple to write or simple to maintain? ;)

To be honest the patch looks like a gross and dangerous hack..

Firstly block layer needs to be properly informed about capacity changes
(set_capacity() + request for partition rescan which the patch doesn't do)
and secondly fixing the problem at the sysfs block/partition layer seems
to be a layering violation (i.e. it also allows partition size changes).

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux