From 4f538d20b3251012bed3cdd9e1777bdaab9be880 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 12 Nov 2008 16:57:10 +0000 Subject: [PATCH] * Wed Nov 12 2008 Eric Sandeen 2.10.1-2 - Recognize gfs/gfs2 in libdisk - Enable parallel builds --- xfsprogs-libdisk-gfs2.patch | 117 ++++++++++++++++++++++++ xfsprogs-parallel-build.patch | 165 ++++++++++++++++++++++++++++++++++ xfsprogs.spec | 11 ++- 3 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 xfsprogs-libdisk-gfs2.patch create mode 100644 xfsprogs-parallel-build.patch diff --git a/xfsprogs-libdisk-gfs2.patch b/xfsprogs-libdisk-gfs2.patch new file mode 100644 index 0000000..8239f52 --- /dev/null +++ b/xfsprogs-libdisk-gfs2.patch @@ -0,0 +1,117 @@ +Recognize gfs & gfs2 disk formats. + +Signed-off-by: Eric Sandeen +--- + +Index: xfsprogs-2.10.1/libdisk/fstype.c +=================================================================== +--- xfsprogs-2.10.1.orig/libdisk/fstype.c 2007-09-10 21:01:17.000000000 -0500 ++++ xfsprogs-2.10.1/libdisk/fstype.c 2008-11-12 10:41:38.996064522 -0600 +@@ -68,6 +68,7 @@ swapped(unsigned short a) { + Added jfs - Christoph Hellwig + Added sysv - Tim Launchbury + Added udf - Bryce Nesbitt ++ Added gfs/gfs2 - Eric Sandeen + */ + + /* +@@ -192,6 +193,7 @@ fstype(const char *device) { + struct hpfs_super_block hpfssb; + struct adfs_super_block adfssb; + struct sysv_super_block svsb; ++ struct gfs2_sb gfs2sb; + struct stat statbuf; + + /* opening and reading an arbitrary unknown path can have +@@ -382,6 +384,21 @@ fstype(const char *device) { + } + + if (!type) { ++ /* block 64 */ ++ if (lseek(fd, GFS_SUPERBLOCK_OFFSET, SEEK_SET) != GFS_SUPERBLOCK_OFFSET ++ || read(fd, (char *) &gfs2sb, sizeof(gfs2sb)) != sizeof(gfs2sb)) ++ goto io_error; ++ if (gfsmagic(gfs2sb)) { ++ if (gfsformat(gfs2sb) == GFS_FORMAT_FS && ++ gfsmultiformat(gfs2sb) == GFS_FORMAT_MULTI) ++ type = "gfs"; ++ else if (gfsformat(gfs2sb) == GFS2_FORMAT_FS && ++ gfsmultiformat(gfs2sb) == GFS2_FORMAT_MULTI) ++ type = "gfs2"; ++ } ++ } ++ ++ if (!type) { + /* perhaps the user tries to mount the swap space + on a new disk; warn her before she does mkfs on it */ + int pagesize = getpagesize(); +Index: xfsprogs-2.10.1/libdisk/fstype.h +=================================================================== +--- xfsprogs-2.10.1.orig/libdisk/fstype.h 2007-09-10 21:01:17.000000000 -0500 ++++ xfsprogs-2.10.1/libdisk/fstype.h 2008-11-12 10:41:38.997064279 -0600 +@@ -242,6 +242,56 @@ struct ocfs_volume_label { + #define ocfslabellen(o) assemble2le(o.label_len) + #define OCFS_MAGIC "OracleCFS" + ++/* Common gfs/gfs2 constants: */ ++#define GFS_MAGIC 0x01161970 ++#define GFS_DEFAULT_BSIZE 4096 ++#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) ++#define GFS_LOCKNAME_LEN 64 ++ ++/* gfs1 constants: */ ++#define GFS_FORMAT_FS 1309 ++#define GFS_FORMAT_MULTI 1401 ++/* gfs2 constants: */ ++#define GFS2_FORMAT_FS 1801 ++#define GFS2_FORMAT_MULTI 1900 ++ ++struct gfs2_meta_header { ++ char mh_magic[4]; ++ char mh_type[4]; ++ char __pad0[8]; /* Was generation number in gfs1 */ ++ char mh_format[4]; ++ char __pad1[4]; /* Was incarnation number in gfs1 */ ++}; ++ ++struct gfs2_inum { ++ char no_formal_ino[8]; ++ char no_addr[8]; ++}; ++ ++struct gfs2_sb { ++ struct gfs2_meta_header sb_header; ++ ++ char sb_fs_format[4]; ++ char sb_multihost_format[4]; ++ char __pad0[4]; /* Was superblock flags in gfs1 */ ++ ++ char sb_bsize[4]; ++ char sb_bsize_shift[4]; ++ char __pad1[4]; /* Was journal segment size in gfs1 */ ++ ++ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ ++ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ ++ struct gfs2_inum sb_root_dir; ++ ++ char sb_lockproto[GFS_LOCKNAME_LEN]; ++ char sb_locktable[GFS_LOCKNAME_LEN]; ++ /* In gfs1, quota and license dinodes followed */ ++}; ++ ++#define gfsmagic(s) assemble4be(s.sb_header.mh_magic) ++#define gfsformat(s) assemble4be(s.sb_fs_format) ++#define gfsmultiformat(s) assemble4be(s.sb_multihost_format) ++ + static inline int + assemble2le(char *p) { + return (p[0] | (p[1] << 8)); +@@ -251,3 +301,8 @@ static inline int + assemble4le(char *p) { + return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); + } ++ ++static inline int ++assemble4be(char *p) { ++ return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24)); ++} diff --git a/xfsprogs-parallel-build.patch b/xfsprogs-parallel-build.patch new file mode 100644 index 0000000..72009ef --- /dev/null +++ b/xfsprogs-parallel-build.patch @@ -0,0 +1,165 @@ +(oops, cvs version...) + +I got tired of waiting for xfsprogs to build +serially... + +On a 16p altix, make -j16 (excluding the configure +phase) went from 2m16s to 33s. + +I tossed this into an rpm and did a fedora scratch +build on all arches, they all passed - some of them, +at least, should have been doing parallel builds too. + +So this has had reasonable testing. + +Signed-off-by: Eric Sandeen +--- + +Index: xfsprogs-2.10.1/Makefile +=================================================================== +--- xfsprogs-2.10.1.orig/Makefile 2007-09-10 21:01:13.000000000 -0500 ++++ xfsprogs-2.10.1/Makefile 2008-11-12 10:41:03.159001661 -0600 +@@ -15,23 +15,28 @@ LSRCFILES = configure configure.in Makep + LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \ + Logs/* built .census install.* install-dev.* *.gz + +-SUBDIRS = include libxfs libxlog libxcmd libhandle libdisk \ +- copy db fsck growfs io logprint mkfs quota mdrestore repair rtcp \ ++LIB_SUBDIRS = include libxfs libxlog libxcmd libhandle libdisk ++TOOL_SUBDIRS = copy db fsck growfs io logprint mkfs quota mdrestore repair rtcp \ + m4 man doc po debian build + ++SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) ++ + default: $(CONFIGURE) + ifeq ($(HAVE_BUILDDEFS), no) + $(MAKE) -C . $@ + else +- $(SUBDIRS_MAKERULE) ++ $(MAKE) $(SUBDIRS) + endif + ++$(TOOL_SUBDIRS) : $(LIB_SUBDIRS) ++ + ifeq ($(HAVE_BUILDDEFS), yes) + include $(BUILDRULES) + else + clean: # if configure hasn't run, nothing to clean + endif + ++.NOTPARALLEL: $(CONFIGURE) + $(CONFIGURE): + autoconf + ./configure \ +@@ -51,14 +56,19 @@ $(CONFIGURE): + aclocal.m4:: + aclocal --acdir=`pwd`/m4 --output=$@ + +-install: default +- $(SUBDIRS_MAKERULE) ++install: default $(addsuffix -install,$(SUBDIRS)) + $(INSTALL) -m 755 -d $(PKG_DOC_DIR) + $(INSTALL) -m 644 README $(PKG_DOC_DIR) + +-install-dev: default ++install-dev: default $(addsuffix -install-dev,$(SUBDIRS)) + $(SUBDIRS_MAKERULE) + ++%-install: ++ $(MAKE) -C $* install ++ ++%-install-dev: ++ $(MAKE) -C $* install-dev ++ + realclean distclean: clean + rm -f $(LDIRT) $(CONFIGURE) + rm -rf autom4te.cache Logs +Index: xfsprogs-2.10.1/include/buildrules +=================================================================== +--- xfsprogs-2.10.1.orig/include/buildrules 2008-09-04 21:37:53.000000000 -0500 ++++ xfsprogs-2.10.1/include/buildrules 2008-11-12 10:39:11.683063452 -0600 +@@ -6,18 +6,22 @@ _BUILDRULES_INCLUDED_ = 1 + + include $(TOPDIR)/include/builddefs + +-clean clobber : $(SUBDIRS) ++clean clobber: $(addsuffix -clean,$(SUBDIRS)) + rm -f $(DIRT) + @rm -fr .libs +- $(SUBDIRS_MAKERULE) ++%-clean:: ++ $(MAKE) -C $* clean + + # Never blow away subdirs + ifdef SUBDIRS + .PRECIOUS: $(SUBDIRS) +-$(SUBDIRS): +- $(SUBDIRS_MAKERULE) + endif + ++.PHONY: $(SUBDIRS) ++ ++$(SUBDIRS): ++ $(MAKE) -C $@ ++ + # + # Standard targets + # +@@ -69,11 +73,13 @@ ifdef LTLIBRARY + DEPENDSCRIPT := $(DEPENDSCRIPT) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' + endif + +-depend : $(CFILES) $(HFILES) +- $(SUBDIRS_MAKERULE) ++depend : $(CFILES) $(HFILES) $(addsuffix -depend,$(SUBDIRS)) + $(DEPENDSCRIPT) > .dep + test -s .dep || rm -f .dep + ++%-depend: ++ $(MAKE) -C $* depend ++ + # Include dep, but only if it exists + ifeq ($(shell test -f .dep && echo .dep), .dep) + include .dep +Index: xfsprogs-2.10.1/include/buildmacros +=================================================================== +--- xfsprogs-2.10.1.orig/include/buildmacros 2007-09-10 21:01:15.000000000 -0500 ++++ xfsprogs-2.10.1/include/buildmacros 2008-11-12 10:39:11.706064211 -0600 +@@ -123,14 +123,6 @@ INSTALL_LINGUAS = \ + done + endif + +-SUBDIRS_MAKERULE = \ +- @for d in $(SUBDIRS) ""; do \ +- if test -d "$$d" -a ! -z "$$d"; then \ +- $(ECHO) === $$d ===; \ +- $(MAKEF) -C $$d $@ || exit $$?; \ +- fi; \ +- done +- + MAN_MAKERULE = \ + @for f in *.[12345678] ""; do \ + if test ! -z "$$f"; then \ +Index: xfsprogs-2.10.1/man/Makefile +=================================================================== +--- xfsprogs-2.10.1.orig/man/Makefile 2007-09-10 21:01:19.000000000 -0500 ++++ xfsprogs-2.10.1/man/Makefile 2008-11-12 10:39:11.714001250 -0600 +@@ -7,7 +7,16 @@ include $(TOPDIR)/include/builddefs + + SUBDIRS = man3 man5 man8 + +-default install install-dev : $(SUBDIRS) +- $(SUBDIRS_MAKERULE) ++default : $(SUBDIRS) ++ ++install : $(addsuffix -install,$(SUBDIRS)) ++ ++install-dev : $(addsuffix -install-dev,$(SUBDIRS)) ++ ++%-install: ++ $(MAKE) -C $* install ++ ++%-install-dev: ++ $(MAKE) -C $* install-dev + + include $(BUILDRULES) diff --git a/xfsprogs.spec b/xfsprogs.spec index 454d983..2185c46 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing the XFS filesystem Name: xfsprogs Version: 2.10.1 -Release: 1%{?dist} +Release: 2%{?dist} # Licensing based on generic "GNU GENERAL PUBLIC LICENSE" # in source, with no mention of version. # doc/COPYING file specifies what is GPL and what is LGPL @@ -18,6 +18,9 @@ Provides: xfs-cmds Obsoletes: xfs-cmds <= %{version} Conflicts: xfsdump < 2.0.0 +Patch0: xfsprogs-parallel-build.patch +Patch1: xfsprogs-libdisk-gfs2.patch + %description A set of commands to use the XFS filesystem, including mkfs.xfs. @@ -47,6 +50,8 @@ also want to install xfsprogs. %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build # xfsprogs abuses libexecdir @@ -110,6 +115,10 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.so %changelog +* Wed Nov 12 2008 Eric Sandeen 2.10.1-2 +- Recognize gfs/gfs2 in libdisk +- Enable parallel builds + * Fri Sep 05 2008 Eric Sandeen 2.10.1-1 - Update to xfsprogs 2.10.1 - Add ASCII case-insensitive support to xfsprogs.