From: Nathan Scott Date: Wed, 18 Jun 2003 06:04:16 +0000 (+0000) Subject: xfsprogs update - Andi's mkfs log size default change and enabling large X-Git-Tag: v2.5.0 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cc4d0db8d182cc8909a4085dcfd30a74fc032fc;p=xfsprogs-dev.git xfsprogs update - Andi's mkfs log size default change and enabling large sector support being the two big ticket items, several other small fixes too. bump to 2.5.0 for default mkfs changes and optional large sector support. --- diff --git a/VERSION b/VERSION index eca79562..8dff1c94 100644 --- a/VERSION +++ b/VERSION @@ -2,6 +2,6 @@ # This file is used by configure to get version information # PKG_MAJOR=2 -PKG_MINOR=4 -PKG_REVISION=12 +PKG_MINOR=5 +PKG_REVISION=0 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 56e79fd5..9c1bc847 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +xfsprogs (2.5.0-1) unstable; urgency=low + + * New upstream release + * Changed mkfs.xfs default log size scaling algorithm slightly, to + create larger logs at smaller filesystem sizes by default + * Enable support for sector sizes larger than 512 bytes + + -- Nathan Scott Wed, 18 Jun 2003 12:56:16 +1000 + xfsprogs (2.4.12-1) unstable; urgency=low * New upstream release diff --git a/doc/CHANGES b/doc/CHANGES index f74be89b..e93d5fde 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,15 @@ +xfsprogs-2.5.0 (18 June 2003) + - Fix libdisk (and hence mkfs) code which warns on MD devices + with the clean flag not set, apparently this is not so wise. + - Fix libxfs_device_zero to work with smaller-than-requested + write return values. + - Fix error in xfs_io pwrite code with large request sizes. + - Fix rounding-down-input problems in several xfs_io commands. + - Changed mkfs.xfs default log size scaling algorithm slightly, + to create larger logs at smaller filesystem sizes by default + (thanks to Andi Kleen for the patch). + - Enable support for sector sizes larger than 512 bytes. + xfsprogs-2.4.12 (02 June 2003) - Fix xfs_logprint handling of any version 2 log device. - Remove calls to exit in libhandle, propogate errors to diff --git a/doc/CREDITS b/doc/CREDITS index c7ac9bed..6e86b54b 100644 --- a/doc/CREDITS +++ b/doc/CREDITS @@ -46,6 +46,13 @@ S: Krosenska' 543 S: 181 00 Praha 8 S: Czech Republic +N: Andi Kleen +E: ak@muc.de +D: Most recently, fine-tuning default mkfs/mount logsize/logbufs values +S: Schwalbenstr. 96 +S: 85551 Ottobrunn +S: Germany + N: Seth Mos E: seth@arosa.nl D: XFS FAQ ( http://oss.sgi.com/projects/xfs/faq.html ) maintainer diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index 5dff46cd..1b3915cb 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -113,8 +113,8 @@ typedef unsigned char uchar_t; #endif #ifndef _BOOLEAN_T_DEFINED - typedef enum { B_FALSE, B_TRUE } boolean_t; - #define _BOOLEAN_T_DEFINED 1 +typedef enum {B_FALSE, B_TRUE} boolean_t; +#define _BOOLEAN_T_DEFINED 1 #endif #elif defined(__FreeBSD__) diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 1983c3e6..16cbcfe8 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -364,6 +364,7 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); #define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */ #define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */ #define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */ +#define XFS_IRECLAIMABLE 0x0010 /* inode can be reclaimed */ /* * Flags for inode locking. diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 27c5df0b..829fd0fa 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -539,7 +539,7 @@ typedef struct xfs_mod_sb { extern xfs_mount_t *xfs_mount_init(void); extern void xfs_mod_sb(xfs_trans_t *, __int64_t); extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv); -extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, dev_t, int); +extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, int); extern int xfs_unmountfs(xfs_mount_t *, struct cred *); extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *); diff --git a/include/xfs_sb.h b/include/xfs_sb.h index f0dea2a8..9a8bc968 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -81,7 +81,7 @@ struct xfs_mount; XFS_SB_VERSION_OKREALFBITS | \ XFS_SB_VERSION_OKSASHFBITS) #define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na,sflag) \ - (((ia) || (dia) || (extflag) || (dirv2) || (na)) ? \ + (((ia) || (dia) || (extflag) || (dirv2) || (na) || (sflag)) ? \ (XFS_SB_VERSION_4 | \ ((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) | \ ((dia) ? XFS_SB_VERSION_DALIGNBIT : 0) | \ diff --git a/include/xfs_types.h b/include/xfs_types.h index 67c460be..38c28e92 100644 --- a/include/xfs_types.h +++ b/include/xfs_types.h @@ -54,11 +54,7 @@ typedef unsigned int __uint32_t; typedef signed long long int __int64_t; typedef unsigned long long int __uint64_t; -#ifndef _BOOLEAN_T_DEFINED - typedef enum { B_FALSE, B_TRUE } boolean_t; - #define _BOOLEAN_T_DEFINED 1 -#endif - +typedef enum { B_FALSE,B_TRUE } boolean_t; typedef __int64_t prid_t; /* project ID */ typedef __uint32_t inst_t; /* an instruction */ diff --git a/io/open.c b/io/open.c index 32c6ef16..21de76e4 100644 --- a/io/open.c +++ b/io/open.c @@ -334,7 +334,7 @@ extsize_f( unsigned int extsize; char *sp; - extsize = strtoul(argv[1], &sp, 10); + extsize = strtoul(argv[1], &sp, 0); if (!sp || sp == argv[1]) { printf(_("non-numeric extsize argument -- %s\n"), argv[1]); return 0; diff --git a/io/pread.c b/io/pread.c index 31cd5437..fe0a4357 100644 --- a/io/pread.c +++ b/io/pread.c @@ -166,7 +166,7 @@ pread_f( printf("%s %s\n", pread_cmd.name, pread_cmd.oneline); return 0; } - offset = strtoul(argv[optind], &sp, 0); + offset = (off64_t) strtoull(argv[optind], &sp, 0); if (!sp || sp == argv[optind]) { printf(_("non-numeric offset argument -- %s\n"), argv[optind]); return 0; diff --git a/io/prealloc.c b/io/prealloc.c index c806cefa..745604e6 100644 --- a/io/prealloc.c +++ b/io/prealloc.c @@ -49,12 +49,12 @@ offset_length( memset(segment, 0, sizeof(*segment)); segment->l_whence = SEEK_SET; - segment->l_start = strtoul(offset, &sp, 0); + segment->l_start = strtoull(offset, &sp, 0); if (!sp || sp == offset) { printf(_("non-numeric offset argument -- %s\n"), offset); return 0; } - segment->l_len = strtoul(length, &sp, 0); + segment->l_len = strtoull(length, &sp, 0); if (!sp || sp == length) { printf(_("non-numeric length argument -- %s\n"), length); return 0; diff --git a/io/pwrite.c b/io/pwrite.c index e1fef4b1..1a42bd12 100644 --- a/io/pwrite.c +++ b/io/pwrite.c @@ -67,7 +67,7 @@ write_buffer( off64_t skip, ssize_t *total) { - ssize_t bytes, itotal = min(bs,count); + ssize_t bytes, bytes_requested, itotal = min(bs, count); *total = 0; while (count > 0) { @@ -75,7 +75,8 @@ write_buffer( if (!read_buffer(fd, skip + *total, bs, &itotal, 0, 1)) break; } - bytes = pwrite64(fdesc, buffer, min(itotal,count), offset); + bytes_requested = min(itotal, count); + bytes = pwrite64(fdesc, buffer, bytes_requested, offset); if (bytes == 0) break; if (bytes < 0) { @@ -83,7 +84,7 @@ write_buffer( return 0; } *total += bytes; - if (bytes < count) + if (bytes < bytes_requested) break; offset += bytes; count -= bytes; @@ -120,7 +121,7 @@ pwrite_f( infile = optarg; break; case 's': - skip = strtoul(optarg, &sp, 0); + skip = (off64_t) strtoull(optarg, &sp, 0); if (!sp || sp == optarg) { printf(_("non-numeric skip -- %s\n"), optarg); return 0; @@ -142,7 +143,7 @@ pwrite_f( printf("%s %s\n", pwrite_cmd.name, pwrite_cmd.oneline); return 0; } - offset = strtoul(argv[optind], &sp, 0); + offset = (off64_t) strtoull(argv[optind], &sp, 0); if (!sp || sp == argv[optind]) { printf(_("non-numeric offset argument -- %s\n"), argv[optind]); return 0; diff --git a/io/resblks.c b/io/resblks.c index 38361787..6c549239 100644 --- a/io/resblks.c +++ b/io/resblks.c @@ -46,7 +46,7 @@ resblks_f( char *sp; if (argc == 2) { - res.resblks = strtoul(argv[1], &sp, 10); + res.resblks = strtoull(argv[1], &sp, 10); if (!sp || sp == argv[1]) { printf(_("non-numeric argument -- %s\n"), argv[1]); return 0; diff --git a/io/truncate.c b/io/truncate.c index 49d54d1e..852ba767 100644 --- a/io/truncate.c +++ b/io/truncate.c @@ -44,7 +44,7 @@ truncate_f( off64_t offset; char *sp; - offset = strtoul(argv[1], &sp, 10); + offset = (off64_t) strtoull(argv[1], &sp, 10); if (!sp || sp == argv[1]) { printf(_("non-numeric truncate argument -- %s\n"), argv[1]); return 0; diff --git a/libdisk/md.c b/libdisk/md.c index 64009bf9..a6a5d004 100644 --- a/libdisk/md.c +++ b/libdisk/md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -70,11 +70,6 @@ md_get_subvol_stripe( close(fd); /* Check state */ - if (!(md.state & (1 << MD_SB_CLEAN))) { - fprintf(stderr, - _("warning - MD array %s not in clean state\n"), - dfile); - } if (md.state & (1 << MD_SB_ERRORS)) { fprintf(stderr, _("warning - MD array %s in error state\n"), diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index 258e51b1..ba388b30 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -36,37 +36,47 @@ #define BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT) #define BDSTRAT_SIZE (256 * 1024) +#define min(x, y) ((x) < (y) ? (x) : (y)) void libxfs_device_zero(dev_t dev, xfs_daddr_t start, uint len) { - xfs_daddr_t bno; - uint nblks; - int size; - int fd; + xfs_off_t start_offset, end_offset, offset; + ssize_t zsize, bytes; char *z; + int fd; - size = BDSTRAT_SIZE <= BBTOB(len) ? BDSTRAT_SIZE : BBTOB(len); - if ((z = memalign(getpagesize(), size)) == NULL) { + zsize = min(BDSTRAT_SIZE, BBTOB(len)); + if ((z = memalign(getpagesize(), zsize)) == NULL) { fprintf(stderr, _("%s: %s can't memalign %d bytes: %s\n"), - progname, __FUNCTION__, size, strerror(errno)); + progname, __FUNCTION__, zsize, strerror(errno)); exit(1); } - memset(z, 0, size); + memset(z, 0, zsize); + fd = libxfs_device_to_fd(dev); - for (bno = start; bno < start + len; ) { - nblks = (uint)BTOBB(size); - if (bno + nblks > start + len) - nblks = (uint)(start + len - bno); - if (pwrite64(fd, z, BBTOB(nblks), BBTOOFF64(bno)) < - BBTOB(nblks)) { - fprintf(stderr, - _("%s: %s write failed: %s\n"), + start_offset = BBTOOFF64(start); + + if ((lseek64(fd, start_offset, SEEK_SET)) < 0) { + fprintf(stderr, _("%s: %s seek to offset %llu failed: %s\n"), + progname, __FUNCTION__, start_offset, strerror(errno)); + exit(1); + } + + end_offset = BBTOOFF64(start + len) - start_offset; + for (offset = 0; offset < end_offset; ) { + bytes = min((ssize_t)(end_offset - offset), zsize); + if ((bytes = write(fd, z, bytes)) < 0) { + fprintf(stderr, _("%s: %s write failed: %s\n"), progname, __FUNCTION__, strerror(errno)); exit(1); + } else if (bytes == 0) { + fprintf(stderr, _("%s: %s not progressing?\n"), + progname, __FUNCTION__); + exit(1); } - bno += nblks; + offset += bytes; } free(z); } diff --git a/libxfs/xfs_inode.c b/libxfs/xfs_inode.c index 25d5a075..c9549d20 100644 --- a/libxfs/xfs_inode.c +++ b/libxfs/xfs_inode.c @@ -190,7 +190,7 @@ xfs_itobp( mp->m_dev, (unsigned long long)imap.im_blkno, i, INT_GET(dip->di_core.di_magic, ARCH_CONVERT)); #endif - XFS_CORRUPTION_ERROR("xfs_itobp", XFS_ERRLEVEL_LOW, + XFS_CORRUPTION_ERROR("xfs_itobp", XFS_ERRLEVEL_HIGH, mp, dip); xfs_trans_brelse(tp, bp); return XFS_ERROR(EFSCORRUPTED); diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index 9c974bfa..520c548a 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -608,8 +608,8 @@ The .B size suboption is used to specify the size of the real-time section. This suboption is only needed if the real-time section of the -filesystem should occupy -less space than the size of the partition or logical volume containing the section. +filesystem should occupy less space than the size of the partition +or logical volume containing the section. .TP .B \-s Sector size options. @@ -625,10 +625,9 @@ The sector size is specified either as a base two logarithm value with or in bytes with .BR size= . The default value is 512 bytes. -.\" The minimum value for sector size is 512; the maximum is 32768 (32 KB). -.\" The sector size cannot be made larger than the filesystem block size. -This option is not yet implemented and sector size other than 512 -bytes cannot be set at this stage. +The minimum value for sector size is 512; the maximum is 32768 (32 KB). +The sector size must be a power of 2 size and cannot be made larger +than the filesystem block size. .TP \f3\-L\f1 \f2label\f1 Set the filesystem label. diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index ca43d994..b5da5d67 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1096,21 +1096,6 @@ main( logversion = 2; } - /* - * Support for non-512 byte sector sizes is a work-in-progress... - */ - -#ifndef EXPERIMENTAL_LARGE_SECTORS - if (sectorsize != XFS_MIN_SECTORSIZE) { - fprintf(stderr, _("unsupported sector size %d\n"), sectorsize); - usage(); - } - if (lsectorsize != XFS_MIN_SECTORSIZE) { - fprintf(stderr, _("unsupported log sector size %d\n"), lsectorsize); - usage(); - } -#endif - if (!nvflag) dirversion = (nsflag || nlflag) ? 2 : XFS_DFL_DIR_VERSION; switch (dirversion) { @@ -1423,6 +1408,8 @@ reported by the device (%u).\n"), [dirblocklog - XFS_MIN_BLOCKSIZE_LOG]; ASSERT(i); min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, i * XFS_MIN_LOG_FACTOR); + if (!logsize && dblocks >= (1024*1024*1024) >> blocklog) + min_logblocks = MAX(min_logblocks, (10*1024*1024)>>blocklog); if (logsize && xi.logBBsize > 0 && logblocks > DTOBT(xi.logBBsize)) { fprintf(stderr, _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), @@ -1443,11 +1430,11 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), else if (loginternal && !logsize) { /* * logblocks grows from min_logblocks to XFS_MAX_LOG_BLOCKS - * at 1TB + * at 128GB * - * 8192 = 1TB / MAX_LOG_BYTES + * 2048 = 128GB / MAX_LOG_BYTES */ - logblocks = (dblocks << blocklog) / 8192; + logblocks = (dblocks << blocklog) / 2048; logblocks = logblocks >> blocklog; logblocks = MAX(min_logblocks, logblocks); logblocks = MAX(logblocks, diff --git a/repair/sb.c b/repair/sb.c index de7fc50b..ef9e0352 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as @@ -219,6 +219,8 @@ calc_ino_align(xfs_sb_t *sb) * sector size info - * sb_sectsize * sb_sectlog + * sb_logsectsize + * sb_logsectlog * * not checked here - * sb_rootino @@ -258,11 +260,11 @@ verify_sb(xfs_sb_t *sb, int is_primary_sb) bsize = 1; - for (i = 0; bsize < sb->sb_blocksize && i < 32; i++) { + for (i = 0; bsize < sb->sb_blocksize && + i < sizeof(sb->sb_blocksize) * NBBY; i++) bsize <<= 1; - } - if (i < XR_LOG2BSIZE_MIN || i > XR_LOG2BSIZE_MAX) + if (i < XFS_MIN_BLOCKSIZE_LOG || i > XFS_MAX_BLOCKSIZE_LOG) return(XR_BAD_BLOCKSIZE); /* check sb blocksize field against sb blocklog field */ @@ -273,9 +275,11 @@ verify_sb(xfs_sb_t *sb, int is_primary_sb) /* sanity check ag count, size fields against data size field */ if (sb->sb_dblocks == 0 || - sb->sb_dblocks > sb->sb_agcount * sb->sb_agblocks || - sb->sb_dblocks < (sb->sb_agcount - 1) - * sb->sb_agblocks + XFS_MIN_AG_BLOCKS) + sb->sb_dblocks > + (__uint64_t)(sb->sb_agcount * sb->sb_agblocks) || + sb->sb_dblocks < + (__uint64_t)((sb->sb_agcount - 1) * sb->sb_agblocks + + XFS_MIN_AG_BLOCKS)) return(XR_BAD_FS_SIZE_DATA); if (sb->sb_agblklog != (__uint8_t)libxfs_log2_roundup(sb->sb_agblocks)) @@ -286,18 +290,49 @@ verify_sb(xfs_sb_t *sb, int is_primary_sb) sb->sb_inopblock != howmany(sb->sb_blocksize,sb->sb_inodesize)) return(XR_BAD_INO_SIZE_DATA); - /* check sector size against log(sector size) field */ + /* check to make sure sectorsize is legal 2^N, 9 <= N <= 15 */ + + if (sb->sb_sectsize == 0) + return(XR_BAD_SECT_SIZE_DATA); bsize = 1; - for (i = 0; bsize < sb->sb_sectsize && i < 15; i++) { + for (i = 0; bsize < sb->sb_sectsize && + i < sizeof(sb->sb_sectsize) * NBBY; i++) { bsize <<= 1; } - if (sb->sb_sectsize == 0 || i == 16 || - sb->sb_sectsize != (1 << i)) + if (i < XFS_MIN_SECTORSIZE_LOG || i > XFS_MAX_SECTORSIZE_LOG) + return(XR_BAD_SECT_SIZE_DATA); + + /* check sb sectorsize field against sb sectlog field */ + + if (i != sb->sb_sectlog) return(XR_BAD_SECT_SIZE_DATA); + if (XFS_SB_VERSION_HASSECTOR(sb)) { + + /* check to make sure log sector is legal 2^N, 9 <= N <= 15 */ + + if (sb->sb_logsectsize == 0) + return(XR_BAD_SECT_SIZE_DATA); + + bsize = 1; + + for (i = 0; bsize < sb->sb_logsectsize && + i < sizeof(sb->sb_logsectsize) * NBBY; i++) { + bsize <<= 1; + } + + if (i < XFS_MIN_SECTORSIZE_LOG || i > XFS_MAX_SECTORSIZE_LOG) + return(XR_BAD_SECT_SIZE_DATA); + + /* check sb log sectorsize field against sb log sectlog field */ + + if (i != sb->sb_logsectlog) + return(XR_BAD_SECT_SIZE_DATA); + } + /* * real-time extent size is always set */