]> granicus.if.org Git - zfs/commitdiff
Fix 32-bit maximum volume size
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 28 Oct 2016 23:53:24 +0000 (23:53 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 2 Nov 2016 19:14:45 +0000 (12:14 -0700)
A limit of 1TB exists for zvols on 32-bit systems.  Update the code
to correctly reflect this limitation in a similar manor as the
OpenZFS implementation.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #5347

include/sys/zvol.h
module/zfs/zvol.c

index 00ed220d3b1776527833aef75aa65e6d30c06c17..2fb20fbf9441138a4d5131c03967c1319c63cdc1 100644 (file)
@@ -32,6 +32,9 @@
 #define        ZVOL_OBJ                1ULL
 #define        ZVOL_ZAP_OBJ            2ULL
 
+#define        SPEC_MAXOFFSET_T        ((1LL << ((NBBY * sizeof (daddr32_t)) + \
+                               DEV_BSHIFT - 1)) - 1)
+
 extern void *zvol_tag;
 
 extern void zvol_create_minors(spa_t *spa, const char *name, boolean_t async);
index b5169baf48d0af31dc51863d3fe9f30b9eb7413a..ea6997b5b9e979902a59bf1fba095e99b2e715d5 100644 (file)
@@ -281,7 +281,7 @@ zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
                return (SET_ERROR(EINVAL));
 
 #ifdef _ILP32
-       if (volsize - 1 > MAXOFFSET_T)
+       if (volsize - 1 > SPEC_MAXOFFSET_T)
                return (SET_ERROR(EOVERFLOW));
 #endif
        return (0);