]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
oracleasm: Introduce module parameter for block size selection
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 28 Nov 2012 14:36:23 +0000 (06:36 -0800)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 29 Jun 2015 15:34:52 +0000 (08:34 -0700)
Orabug: 15924773
We have encountered a few devices which after a firmware update
communicate different characteristics to the OS. In particular, some
devices begin to report their physical block size. This in turn will
cause oracleasm to report a different block size to ASM and mounting the
disk group will fail.

Introduce a module parameter which permits the logical block size to be
reported instead of the physical.

Signed-off-by: Martin K. Petersen<martin.petersen@oracle.com>
(cherry picked from commit 0d81a777b246ef0edbc37a7d6ca23fa14fd8fe79)

drivers/block/oracleasm/driver.c
include/linux/oracleasm/disk.h

index 5d7f2a177950d7591c9f8905860276c4558f3d5e..2522ba6404fba858ea5835e7c344209ae15a4c5d 100644 (file)
@@ -127,6 +127,19 @@ static struct kmem_cache   *asm_request_cachep;
 static struct kmem_cache       *asmfs_inode_cachep;
 static struct kmem_cache       *asmdisk_cachep;
 
+static bool use_logical_block_size = false;
+module_param(use_logical_block_size, bool, 0644);
+MODULE_PARM_DESC(use_logical_block_size,
+       "Prefer logical block size over physical (Y=logical, N=physical [default])");
+
+static inline unsigned int asm_block_size(struct block_device *bdev)
+{
+       if (use_logical_block_size)
+               return bdev_logical_block_size(bdev);
+
+       return bdev_physical_block_size(bdev);
+}
+
 /*
  * asmfs super-block data in memory
  */
@@ -710,7 +723,7 @@ static int asm_open_disk(struct file *file, struct block_device *bdev)
        if (ret)
                goto out;
 
-       ret = set_blocksize(bdev, bdev_physical_block_size(bdev));
+       ret = set_blocksize(bdev, asm_block_size(bdev));
        if (ret)
                goto out_get;
 
@@ -1281,7 +1294,7 @@ static int asm_submit_io(struct file *file,
 
        bdev = d->d_bdev;
 
-       r->r_count = ioc->rcount_asm_ioc * bdev_physical_block_size(bdev);
+       r->r_count = ioc->rcount_asm_ioc * asm_block_size(bdev);
 
        /* linux only supports unsigned long size sector numbers */
        mlog(ML_IOC,
@@ -1387,8 +1400,7 @@ static int asm_submit_io(struct file *file,
        /* Block layer always uses 512-byte sector addressing,
         * regardless of logical and physical block size.
         */
-       r->r_bio->bi_sector = ioc->first_asm_ioc *
-               (bdev_physical_block_size(bdev) >> 9);
+       r->r_bio->bi_sector = ioc->first_asm_ioc * (asm_block_size(bdev) >> 9);
 
        if (it) {
                ret = asm_integrity_map(it, r, rw == READ);
@@ -2362,7 +2374,7 @@ static ssize_t asmfs_svc_query_disk(struct file *file, char *buf, size_t size)
        bdev = I_BDEV(filp->f_mapping->host);
 
        qd_info->qd_max_sectors = compute_max_sectors(bdev);
-       qd_info->qd_hardsect_size = bdev_physical_block_size(bdev);
+       qd_info->qd_hardsect_size = asm_block_size(bdev);
        qd_info->qd_feature = asm_integrity_format(bdev) &
                ASM_INTEGRITY_QDF_MASK;
        mlog(ML_ABI|ML_DISK,
index a1e468d8a354fcbba6eea9c1f5b060785059b8a1..2f6043e305b66d7af1187ea80fbc15bdda936887 100644 (file)
@@ -79,6 +79,7 @@
 #define ASM_DISK_LABEL_MARKED   "ORCLDISK"
 #define ASM_DISK_LABEL_CLEAR    "ORCLCLRD"
 #define ASM_DISK_LABEL_OFFSET   32
+#define ASM_DISK_LABEL_ID_SIZE 24
 
 struct asm_disk_label {
        char dl_tag[8];