Fix 32-bit maximum volume size

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
This commit is contained in:
Brian Behlendorf 2016-10-28 23:53:24 +00:00
parent 4990e576c6
commit 82ec9d41d8
2 changed files with 4 additions and 1 deletions

View 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);

View 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);