From 33361bb5db68a1805cf4f40fdf8783de96bbf527 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sat, 18 Feb 2006 03:00:49 +0000 Subject: [PATCH] If provider's sector size prevents reading SBLOCKSIZE bytes return immediatelly. --- sys/geom/label/g_label_ufs.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c index 02e9761333b9..d5372937f3d6 100644 --- a/sys/geom/label/g_label_ufs.c +++ b/sys/geom/label/g_label_ufs.c @@ -52,6 +52,10 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size) g_topology_assert_not(); pp = cp->provider; label[0] = '\0'; + + if (SBLOCKSIZE % cp->provider->sectorsize != 0) + return (0); + /* * Walk through the standard places that superblocks hide and look * for UFS magic. If we find magic, then check that the size in the @@ -61,17 +65,15 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size) */ for (sb = 0; (superblock = superblocks[sb]) != -1; sb++) { /* - * Take care not to issue an invalid I/O request. The - * offset and size of the superblock candidate must be - * multiples of the provider's sector size, otherwise an - * FFS can't exist on the provider anyway. + * Take care not to issue an invalid I/O request. The offset of + * the superblock candidate must be multiples of the provider's + * sector size, otherwise an FFS can't exist on the provider + * anyway. */ - if (superblock % cp->provider->sectorsize != 0 || - SBLOCKSIZE % cp->provider->sectorsize != 0) + if (superblock % cp->provider->sectorsize != 0) continue; - fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, - NULL); + fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL); if (fs == NULL) continue; /* Check for magic and make sure things are the right size */