block: allow device to have both virt_boundary_mask and max segment size
[linux-block.git] / block / blk-settings.c
index 3c7d8d638ab59dc9704aa01217c9b940b5941e4b..d2731843f2fccb481eda94e1a1dc980051d2486a 100644 (file)
@@ -146,8 +146,7 @@ static int blk_validate_limits(struct queue_limits *lim)
        max_hw_sectors = min_not_zero(lim->max_hw_sectors,
                                lim->max_dev_sectors);
        if (lim->max_user_sectors) {
-               if (lim->max_user_sectors > max_hw_sectors ||
-                   lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
+               if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
                        return -EINVAL;
                lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors);
        } else {
@@ -183,17 +182,13 @@ static int blk_validate_limits(struct queue_limits *lim)
                return -EINVAL;
 
        /*
-        * Devices that require a virtual boundary do not support scatter/gather
-        * I/O natively, but instead require a descriptor list entry for each
-        * page (which might not be identical to the Linux PAGE_SIZE).  Because
-        * of that they are not limited by our notion of "segment size".
+        * Stacking device may have both virtual boundary and max segment
+        * size limit, so allow this setting now, and long-term the two
+        * might need to move out of stacking limits since we have immutable
+        * bvec and lower layer bio splitting is supposed to handle the two
+        * correctly.
         */
-       if (lim->virt_boundary_mask) {
-               if (WARN_ON_ONCE(lim->max_segment_size &&
-                                lim->max_segment_size != UINT_MAX))
-                       return -EINVAL;
-               lim->max_segment_size = UINT_MAX;
-       } else {
+       if (!lim->virt_boundary_mask) {
                /*
                 * The maximum segment size has an odd historic 64k default that
                 * drivers probably should override.  Just like the I/O size we