Date: Wed, 25 Oct 2017 16:01:19 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324991 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <201710251601.v9PG1JKC032407@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Oct 25 16:01:19 2017 New Revision: 324991 URL: https://svnweb.freebsd.org/changeset/base/324991 Log: Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0 Previously, zpool_read_all_labels was trying to do 256KB reads, which are greater than the default MAXPHYS and therefore must go through the slow, unsafe AIO path. Shrink these reads to 112KB so they can use the safe, fast AIO path instead. MFC after: 1 week X-MFC-With: 324568 Sponsored by: Spectra Logic Corp Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 25 15:30:53 2017 (r324990) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 25 16:01:19 2017 (r324991) @@ -930,7 +930,7 @@ zpool_read_all_labels(int fd, nvlist_t **config) struct aiocb aiocbs[VDEV_LABELS]; struct aiocb *aiocbps[VDEV_LABELS]; int l; - vdev_label_t *labels; + vdev_phys_t *labels; uint64_t state, txg, size; int nlabels = 0; @@ -940,15 +940,15 @@ zpool_read_all_labels(int fd, nvlist_t **config) return (0); size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); - if ((labels = calloc(VDEV_LABELS, sizeof (vdev_label_t))) == NULL) + if ((labels = calloc(VDEV_LABELS, sizeof (vdev_phys_t))) == NULL) return (0); memset(aiocbs, 0, sizeof(aiocbs)); for (l = 0; l < VDEV_LABELS; l++) { aiocbs[l].aio_fildes = fd; - aiocbs[l].aio_offset = label_offset(size, l); + aiocbs[l].aio_offset = label_offset(size, l) + VDEV_SKIP_SIZE; aiocbs[l].aio_buf = &labels[l]; - aiocbs[l].aio_nbytes = sizeof(vdev_label_t); + aiocbs[l].aio_nbytes = sizeof(vdev_phys_t); aiocbs[l].aio_lio_opcode = LIO_READ; aiocbps[l] = &aiocbs[l]; } @@ -962,17 +962,18 @@ zpool_read_all_labels(int fd, nvlist_t **config) (void)aio_return(&aiocbs[l]); } } + free(labels); return (0); } for (l = 0; l < VDEV_LABELS; l++) { nvlist_t *temp = NULL; - if (aio_return(&aiocbs[l]) != sizeof(vdev_label_t)) + if (aio_return(&aiocbs[l]) != sizeof(vdev_phys_t)) continue; - if (nvlist_unpack(labels[l].vl_vdev_phys.vp_nvlist, - sizeof (labels[l].vl_vdev_phys.vp_nvlist), &temp, 0) != 0) + if (nvlist_unpack(labels[l].vp_nvlist, + sizeof (labels[l].vp_nvlist), &temp, 0) != 0) continue; if (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_STATE,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710251601.v9PG1JKC032407>