From owner-svn-src-all@FreeBSD.ORG Tue Dec 25 17:39:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6C649739; Tue, 25 Dec 2012 17:39:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 437A18FC12; Tue, 25 Dec 2012 17:39:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBPHdc8I099618; Tue, 25 Dec 2012 17:39:38 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBPHdbwv099614; Tue, 25 Dec 2012 17:39:37 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201212251739.qBPHdbwv099614@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 25 Dec 2012 17:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244687 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Dec 2012 17:39:38 -0000 Author: pfg Date: Tue Dec 25 17:39:37 2012 New Revision: 244687 URL: http://svnweb.freebsd.org/changeset/base/244687 Log: MFC r244475: More constant renaming in preparation for newer features. We also try to make better use of the fs flags instead of trying adapt the code according to the fs structures. In the case of subsecond timestamps and birthtime we now check that the feature is explicitly enabled: previously we only checked that the reserved space was available and silently wrote them. This approach is much safer, especially if the filesystem happens to use embedded inodes or support EAs. Discussed with: Zheng Liu, bde Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h stable/9/sys/fs/ext2fs/ext2_inode_cnv.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2fs.h Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dinode.h Tue Dec 25 17:06:05 2012 (r244686) +++ stable/9/sys/fs/ext2fs/ext2_dinode.h Tue Dec 25 17:39:37 2012 (r244687) @@ -60,15 +60,16 @@ #define EXT2_APPEND 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP 0x00000040 /* do not dump file */ #define EXT2_NOATIME 0x00000080 /* do not update atime */ -#define EXT2_INDEX 0x00001000 /* hash-indexed directory */ -#define EXT2_IMAGIC 0x00002000 /* AFS directory */ -#define EXT2_JOURNAL_DATA 0x00004000 /* file data should be journaled */ -#define EXT2_NOTAIL 0x00008000 /* file tail should not be merged */ -#define EXT2_DIRSYNC 0x00010000 /* dirsync behaviour */ -#define EXT2_TOPDIR 0x00020000 /* Top of directory hierarchies*/ -#define EXT2_HUGE_FILE 0x00040000 /* Set to each huge file */ -#define EXT2_EXTENTS 0x00080000 /* Inode uses extents */ -#define EXT2_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ + +#define EXT4_INDEX 0x00001000 /* hash-indexed directory */ +#define EXT4_IMAGIC 0x00002000 /* AFS directory */ +#define EXT4_JOURNAL_DATA 0x00004000 /* file data should be journaled */ +#define EXT4_NOTAIL 0x00008000 /* file tail should not be merged */ +#define EXT4_DIRSYNC 0x00010000 /* dirsync behaviour */ +#define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/ +#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */ +#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */ +#define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ /* * Definitions for nanosecond timestamps. @@ -78,8 +79,7 @@ #define EXT3_EPOCH_MASK ((1 << EXT3_EPOCH_BITS) - 1) #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS) -#define E2DI_HAS_XTIME(ip) (EXT2_INODE_SIZE((ip)->i_e2fs) > \ - E2FS_REV0_INODE_SIZE) +#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_EXTRA_ISIZE)) /* * Structure of an inode on the disk Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Dec 25 17:06:05 2012 (r244686) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Dec 25 17:39:37 2012 (r244687) @@ -27,17 +27,18 @@ */ #include #include +#include #include #include #include #include #include -#include #include +#include #define XTIME_TO_NSEC(x) ((x & EXT3_NSEC_MASK) >> 2) -#define NSEC_TO_XTIME(t) ((t << 2) & EXT3_NSEC_MASK) +#define NSEC_TO_XTIME(t) (le32toh(t << 2) & EXT3_NSEC_MASK) void ext2_print_inode( in ) Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue Dec 25 17:06:05 2012 (r244686) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Tue Dec 25 17:39:37 2012 (r244687) @@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str } } /* Check for extra isize in big inodes. */ - if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT4F_ROCOMPAT_EXTRA_ISIZE) && + if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_EXTRA_ISIZE) && EXT2_INODE_SIZE(fs) < sizeof(struct ext2fs_dinode)) { printf("ext2fs: no space for extra inode timestamps\n"); return (EINVAL); Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Tue Dec 25 17:06:05 2012 (r244686) +++ stable/9/sys/fs/ext2fs/ext2fs.h Tue Dec 25 17:39:37 2012 (r244687) @@ -215,18 +215,18 @@ struct m_ext2fs { #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 #define EXT2F_ROCOMPAT_BTREE_DIR 0x0004 -#define EXT4F_ROCOMPAT_HUGE_FILE 0x0008 -#define EXT4F_ROCOMPAT_GDT_CSUM 0x0010 -#define EXT4F_ROCOMPAT_DIR_NLINK 0x0020 -#define EXT4F_ROCOMPAT_EXTRA_ISIZE 0x0040 +#define EXT2F_ROCOMPAT_HUGE_FILE 0x0008 +#define EXT2F_ROCOMPAT_GDT_CSUM 0x0010 +#define EXT2F_ROCOMPAT_DIR_NLINK 0x0020 +#define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 -#define EXT4F_INCOMPAT_META_BG 0x0010 -#define EXT4F_INCOMPAT_EXTENTS 0x0040 -#define EXT4F_INCOMPAT_64BIT 0x0080 -#define EXT4F_INCOMPAT_MMP 0x0100 -#define EXT4F_INCOMPAT_FLEX_BG 0x0200 +#define EXT2F_INCOMPAT_META_BG 0x0010 +#define EXT2F_INCOMPAT_EXTENTS 0x0040 +#define EXT2F_INCOMPAT_64BIT 0x0080 +#define EXT2F_INCOMPAT_MMP 0x0100 +#define EXT2F_INCOMPAT_FLEX_BG 0x0200 /* * Features supported in this implementation @@ -239,7 +239,7 @@ struct m_ext2fs { #define EXT2F_COMPAT_SUPP 0x0000 #define EXT2F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER | \ EXT2F_ROCOMPAT_LARGEFILE | \ - EXT4F_ROCOMPAT_EXTRA_ISIZE) + EXT2F_ROCOMPAT_EXTRA_ISIZE) #define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE /* Assume that user mode programs are passing in an ext2fs superblock, not