From e78b9efb81c167b092a397686d46ae97bff20857 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Fri, 11 Nov 2005 14:24:36 +0000 Subject: [PATCH] Report inline attr version, and allow mkfs to explicitly set it too. Merge of master-melb:xfs-cmds:24371a by kenmcd. --- growfs/xfs_growfs.c | 14 +++++++++----- include/xfs_sb.h | 12 +++++++----- man/man8/mkfs.xfs.8 | 18 +++++++++++++++--- mkfs/xfs_mkfs.c | 23 ++++++++++++++++++----- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c index 01c9aa2f9..da0e1347a 100644 --- a/growfs/xfs_growfs.c +++ b/growfs/xfs_growfs.c @@ -74,11 +74,12 @@ report_info( char *rtname, int unwritten, int dirversion, - int logversion) + int logversion, + int attrversion) { printf(_( "meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n" - " =%-22s sectsz=%-5u\n" + " =%-22s sectsz=%-5u attr=%u\n" "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" " =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n" "naming =version %-14u bsize=%-6u\n" @@ -87,7 +88,7 @@ report_info( "realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"), mntpoint, geo.inodesize, geo.agcount, geo.agblocks, - "", geo.sectsize, + "", geo.sectsize, attrversion, "", geo.blocksize, (unsigned long long)geo.datablocks, geo.imaxpct, "", geo.sunit, geo.swidth, unwritten, @@ -107,6 +108,7 @@ main(int argc, char **argv) int c; /* current option character */ long long ddsize; /* device size in 512-byte blocks */ int dflag; /* -d flag */ + int attrversion;/* attribute version number */ int dirversion; /* directory version number */ int logversion; /* log version number */ long long dlsize; /* device size in 512-byte blocks */ @@ -249,10 +251,12 @@ main(int argc, char **argv) unwritten = geo.flags & XFS_FSOP_GEOM_FLAGS_EXTFLG ? 1 : 0; dirversion = geo.flags & XFS_FSOP_GEOM_FLAGS_DIRV2 ? 2 : 1; logversion = geo.flags & XFS_FSOP_GEOM_FLAGS_LOGV2 ? 2 : 1; + attrversion = geo.flags & XFS_FSOP_GEOM_FLAGS_ATTR2 ? 2 : \ + (geo.flags & XFS_FSOP_GEOM_FLAGS_ATTR ? 1 : 0); if (nflag) { report_info(geo, datadev, isint, logdev, rtdev, - unwritten, dirversion, logversion); + unwritten, dirversion, logversion, attrversion); exit(0); } @@ -289,7 +293,7 @@ main(int argc, char **argv) } report_info(geo, datadev, isint, logdev, rtdev, - unwritten, dirversion, logversion); + unwritten, dirversion, logversion, attrversion); ddsize = xi.dsize; dlsize = ( xi.logBBsize? xi.logBBsize : diff --git a/include/xfs_sb.h b/include/xfs_sb.h index 4a17d335f..efb7073b8 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -68,15 +68,16 @@ struct xfs_mount; (XFS_SB_VERSION_NUMBITS | \ XFS_SB_VERSION_OKREALFBITS | \ XFS_SB_VERSION_OKSASHFBITS) -#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na,sflag,morebits) \ - (((ia) || (dia) || (extflag) || (dirv2) || (na) || (sflag) || \ - (morebits)) ? \ +#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,logv2,attrv1,sflag,morebits) \ + (((ia) || (dia) || (extflag) || (dirv2) || (logv2) || (attrv1) || \ + (sflag) || (morebits)) ? \ (XFS_SB_VERSION_4 | \ ((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) | \ ((dia) ? XFS_SB_VERSION_DALIGNBIT : 0) | \ ((extflag) ? XFS_SB_VERSION_EXTFLGBIT : 0) | \ ((dirv2) ? XFS_SB_VERSION_DIRV2BIT : 0) | \ - ((na) ? XFS_SB_VERSION_LOGV2BIT : 0) | \ + ((logv2) ? XFS_SB_VERSION_LOGV2BIT : 0) | \ + ((attrv1) ? XFS_SB_VERSION_ATTRBIT : 0) | \ ((sflag) ? XFS_SB_VERSION_SECTORBIT : 0) | \ ((morebits) ? XFS_SB_VERSION_MOREBITSBIT : 0)) : \ XFS_SB_VERSION_1) @@ -108,7 +109,8 @@ struct xfs_mount; /* * mkfs macro to set up sb_features2 word */ -#define XFS_SB_VERSION2_MKFS(resvd1, sbcntr) 0 +#define XFS_SB_VERSION2_MKFS(resvd1, sbcntr, attrv2) \ + (((attrv2) ? XFS_SB_VERSION2_ATTR2BIT : 0)) typedef struct xfs_sb { diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index de9be49f5..a32873fa7 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -281,9 +281,9 @@ XFS uses 64-bit inode numbers internally; however, the number of significant bits in an inode number is affected by filesystem geometry. In practice, filesystem size and inode size are the predominant factors. -The Linux kernel and most applications cannot currently handle -inode numbers greater than 32 significant bits, so if no -inode size is given on the command line, +The Linux kernel (on 32 bit hardware platforms) and most applications +cannot currently handle inode numbers greater than 32 significant bits, +so if no inode size is given on the command line, .I mkfs.xfs will attempt to choose a size such that inode numbers will be < 32 bits. If an inode size @@ -312,6 +312,18 @@ This option can be used to turn off inode alignment when the filesystem needs to be mountable by a version of IRIX that does not have the inode alignment feature (any release of IRIX before 6.2, and IRIX 6.2 without XFS patches). +.IP +The option +.BI attr[= value ] +is used to specify the version of extended attribute inline allocation +policy to be used. +By default, this is zero. Once extended attributes are used for the +first time, the version will be set to either one or two. +The current version (two) uses a more efficient algorithm for managing +the available inline inode space than version one does, however, for +backward compatibility reasons (and in the absence of the \f3attr\f1=\f22\f1 +mkfs option, or the \f2attr2\f1 mount option), version one will be selected +by default when attributes are first used on a filesystem. .TP .B \-l Log section options. diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 18baf1d47..cbea54487 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -104,6 +104,8 @@ char *iopts[] = { "perblock", #define I_SIZE 4 "size", +#define I_ATTR 5 + "attr", NULL }; @@ -527,6 +529,7 @@ main( xfs_agnumber_t agno; __uint64_t agsize; xfs_alloc_rec_t *arec; + int attrversion; xfs_btree_sblock_t *block; int blflag; int blocklog; @@ -619,6 +622,7 @@ main( bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + attrversion = 0; blflag = bsflag = slflag = ssflag = lslflag = lssflag = 0; blocklog = blocksize = 0; sectorlog = lsectorlog = XFS_MIN_SECTORSIZE_LOG; @@ -955,6 +959,14 @@ main( inodelog = libxfs_highbit32(isize); isflag = 1; break; + case I_ATTR: + if (!value) + reqval('i', iopts, I_ATTR); + c = atoi(value); + if (c < 0 || c > 2) + illegal(value, "i attr"); + attrversion = c; + break; default: unknown('i', value); } @@ -1940,7 +1952,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), if (!qflag || Nflag) { printf(_( "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n" - " =%-22s sectsz=%-5u\n" + " =%-22s sectsz=%-5u attr=%u\n" "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" " =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n" "naming =version %-14u bsize=%-6u\n" @@ -1948,7 +1960,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), " =%-22s sectsz=%-5u sunit=%d blks\n" "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"), dfile, isize, (long long)agcount, (long long)agsize, - "", sectorsize, + "", sectorsize, attrversion, "", blocksize, (long long)dblocks, imflag ? imaxpct : XFS_DFL_IMAXIMUM_PCT, "", dsunit, dswidth, extent_flagging, @@ -2018,10 +2030,11 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), } sbp->sb_versionnum = XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, extent_flagging, - dirversion == 2, logversion == 2, + dirversion == 2, logversion == 2, attrversion == 1, (sectorsize != BBSIZE || lsectorsize != BBSIZE), - (0 /*mmr*/ || 0 /*lazy_sb_counters*/)); - sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0 /*mmr*/, 0); + (0/*mmr*/|| 0/*lazy_sb_counters*/ || attrversion == 2)); + sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0/*mmr*/,0/*lazy_sb_counters*/, + attrversion == 2); /* * Zero out the beginning of the device, to obliterate any old -- 2.47.2