···11-/*22- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.33- * All Rights Reserved.44- *55- * This program is free software; you can redistribute it and/or66- * modify it under the terms of the GNU General Public License as77- * published by the Free Software Foundation.88- *99- * This program is distributed in the hope that it would be useful,1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212- * GNU General Public License for more details.1313- *1414- * You should have received a copy of the GNU General Public License1515- * along with this program; if not, write the Free Software Foundation,1616- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA1717- */1818-#ifndef __XFS_AG_H__1919-#define __XFS_AG_H__2020-2121-/*2222- * Allocation group header2323- * This is divided into three structures, placed in sequential 512-byte2424- * buffers after a copy of the superblock (also in a 512-byte buffer).2525- */2626-2727-struct xfs_buf;2828-struct xfs_mount;2929-struct xfs_trans;3030-3131-#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */3232-#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */3333-#define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */3434-#define XFS_AGF_VERSION 13535-#define XFS_AGI_VERSION 13636-3737-#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)3838-#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)3939-4040-/*4141- * Btree number 0 is bno, 1 is cnt. This value gives the size of the4242- * arrays below.4343- */4444-#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1)4545-4646-/*4747- * The second word of agf_levels in the first a.g. overlaps the EFS4848- * superblock's magic number. Since the magic numbers valid for EFS4949- * are > 64k, our value cannot be confused for an EFS superblock's.5050- */5151-5252-typedef struct xfs_agf {5353- /*5454- * Common allocation group header information5555- */5656- __be32 agf_magicnum; /* magic number == XFS_AGF_MAGIC */5757- __be32 agf_versionnum; /* header version == XFS_AGF_VERSION */5858- __be32 agf_seqno; /* sequence # starting from 0 */5959- __be32 agf_length; /* size in blocks of a.g. */6060- /*6161- * Freespace information6262- */6363- __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */6464- __be32 agf_spare0; /* spare field */6565- __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */6666- __be32 agf_spare1; /* spare field */6767-6868- __be32 agf_flfirst; /* first freelist block's index */6969- __be32 agf_fllast; /* last freelist block's index */7070- __be32 agf_flcount; /* count of blocks in freelist */7171- __be32 agf_freeblks; /* total free blocks */7272-7373- __be32 agf_longest; /* longest free space */7474- __be32 agf_btreeblks; /* # of blocks held in AGF btrees */7575- uuid_t agf_uuid; /* uuid of filesystem */7676-7777- /*7878- * reserve some contiguous space for future logged fields before we add7979- * the unlogged fields. This makes the range logging via flags and8080- * structure offsets much simpler.8181- */8282- __be64 agf_spare64[16];8383-8484- /* unlogged fields, written during buffer writeback. */8585- __be64 agf_lsn; /* last write sequence */8686- __be32 agf_crc; /* crc of agf sector */8787- __be32 agf_spare2;8888-8989- /* structure must be padded to 64 bit alignment */9090-} xfs_agf_t;9191-9292-#define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)9393-9494-#define XFS_AGF_MAGICNUM 0x000000019595-#define XFS_AGF_VERSIONNUM 0x000000029696-#define XFS_AGF_SEQNO 0x000000049797-#define XFS_AGF_LENGTH 0x000000089898-#define XFS_AGF_ROOTS 0x000000109999-#define XFS_AGF_LEVELS 0x00000020100100-#define XFS_AGF_FLFIRST 0x00000040101101-#define XFS_AGF_FLLAST 0x00000080102102-#define XFS_AGF_FLCOUNT 0x00000100103103-#define XFS_AGF_FREEBLKS 0x00000200104104-#define XFS_AGF_LONGEST 0x00000400105105-#define XFS_AGF_BTREEBLKS 0x00000800106106-#define XFS_AGF_UUID 0x00001000107107-#define XFS_AGF_NUM_BITS 13108108-#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)109109-110110-#define XFS_AGF_FLAGS \111111- { XFS_AGF_MAGICNUM, "MAGICNUM" }, \112112- { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \113113- { XFS_AGF_SEQNO, "SEQNO" }, \114114- { XFS_AGF_LENGTH, "LENGTH" }, \115115- { XFS_AGF_ROOTS, "ROOTS" }, \116116- { XFS_AGF_LEVELS, "LEVELS" }, \117117- { XFS_AGF_FLFIRST, "FLFIRST" }, \118118- { XFS_AGF_FLLAST, "FLLAST" }, \119119- { XFS_AGF_FLCOUNT, "FLCOUNT" }, \120120- { XFS_AGF_FREEBLKS, "FREEBLKS" }, \121121- { XFS_AGF_LONGEST, "LONGEST" }, \122122- { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \123123- { XFS_AGF_UUID, "UUID" }124124-125125-/* disk block (xfs_daddr_t) in the AG */126126-#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))127127-#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))128128-#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr))129129-130130-extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,131131- xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);132132-133133-/*134134- * Size of the unlinked inode hash table in the agi.135135- */136136-#define XFS_AGI_UNLINKED_BUCKETS 64137137-138138-typedef struct xfs_agi {139139- /*140140- * Common allocation group header information141141- */142142- __be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */143143- __be32 agi_versionnum; /* header version == XFS_AGI_VERSION */144144- __be32 agi_seqno; /* sequence # starting from 0 */145145- __be32 agi_length; /* size in blocks of a.g. */146146- /*147147- * Inode information148148- * Inodes are mapped by interpreting the inode number, so no149149- * mapping data is needed here.150150- */151151- __be32 agi_count; /* count of allocated inodes */152152- __be32 agi_root; /* root of inode btree */153153- __be32 agi_level; /* levels in inode btree */154154- __be32 agi_freecount; /* number of free inodes */155155-156156- __be32 agi_newino; /* new inode just allocated */157157- __be32 agi_dirino; /* last directory inode chunk */158158- /*159159- * Hash table of inodes which have been unlinked but are160160- * still being referenced.161161- */162162- __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];163163- /*164164- * This marks the end of logging region 1 and start of logging region 2.165165- */166166- uuid_t agi_uuid; /* uuid of filesystem */167167- __be32 agi_crc; /* crc of agi sector */168168- __be32 agi_pad32;169169- __be64 agi_lsn; /* last write sequence */170170-171171- __be32 agi_free_root; /* root of the free inode btree */172172- __be32 agi_free_level;/* levels in free inode btree */173173-174174- /* structure must be padded to 64 bit alignment */175175-} xfs_agi_t;176176-177177-#define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)178178-179179-#define XFS_AGI_MAGICNUM (1 << 0)180180-#define XFS_AGI_VERSIONNUM (1 << 1)181181-#define XFS_AGI_SEQNO (1 << 2)182182-#define XFS_AGI_LENGTH (1 << 3)183183-#define XFS_AGI_COUNT (1 << 4)184184-#define XFS_AGI_ROOT (1 << 5)185185-#define XFS_AGI_LEVEL (1 << 6)186186-#define XFS_AGI_FREECOUNT (1 << 7)187187-#define XFS_AGI_NEWINO (1 << 8)188188-#define XFS_AGI_DIRINO (1 << 9)189189-#define XFS_AGI_UNLINKED (1 << 10)190190-#define XFS_AGI_NUM_BITS_R1 11 /* end of the 1st agi logging region */191191-#define XFS_AGI_ALL_BITS_R1 ((1 << XFS_AGI_NUM_BITS_R1) - 1)192192-#define XFS_AGI_FREE_ROOT (1 << 11)193193-#define XFS_AGI_FREE_LEVEL (1 << 12)194194-#define XFS_AGI_NUM_BITS_R2 13195195-196196-/* disk block (xfs_daddr_t) in the AG */197197-#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))198198-#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))199199-#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr))200200-201201-extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,202202- xfs_agnumber_t agno, struct xfs_buf **bpp);203203-204204-/*205205- * The third a.g. block contains the a.g. freelist, an array206206- * of block pointers to blocks owned by the allocation btree code.207207- */208208-#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))209209-#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))210210-#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))211211-212212-#define XFS_BUF_TO_AGFL_BNO(mp, bp) \213213- (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \214214- &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \215215- (__be32 *)(bp)->b_addr)216216-217217-/*218218- * Size of the AGFL. For CRC-enabled filesystes we steal a couple of219219- * slots in the beginning of the block for a proper header with the220220- * location information and CRC.221221- */222222-#define XFS_AGFL_SIZE(mp) \223223- (((mp)->m_sb.sb_sectsize - \224224- (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \225225- sizeof(struct xfs_agfl) : 0)) / \226226- sizeof(xfs_agblock_t))227227-228228-typedef struct xfs_agfl {229229- __be32 agfl_magicnum;230230- __be32 agfl_seqno;231231- uuid_t agfl_uuid;232232- __be64 agfl_lsn;233233- __be32 agfl_crc;234234- __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */235235-} xfs_agfl_t;236236-237237-#define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc)238238-239239-/*240240- * tags for inode radix tree241241- */242242-#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged lookup243243- in xfs_inode_ag_iterator */244244-#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */245245-#define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */246246-247247-#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)248248-#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \249249- (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))250250-#define XFS_MIN_FREELIST(a,mp) \251251- (XFS_MIN_FREELIST_RAW( \252252- be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \253253- be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))254254-#define XFS_MIN_FREELIST_PAG(pag,mp) \255255- (XFS_MIN_FREELIST_RAW( \256256- (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \257257- (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))258258-259259-#define XFS_AGB_TO_FSB(mp,agno,agbno) \260260- (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))261261-#define XFS_FSB_TO_AGNO(mp,fsbno) \262262- ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))263263-#define XFS_FSB_TO_AGBNO(mp,fsbno) \264264- ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))265265-#define XFS_AGB_TO_DADDR(mp,agno,agbno) \266266- ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \267267- (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))268268-#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))269269-270270-/*271271- * For checking for bad ranges of xfs_daddr_t's, covering multiple272272- * allocation groups or a single xfs_daddr_t that's a superblock copy.273273- */274274-#define XFS_AG_CHECK_DADDR(mp,d,len) \275275- ((len) == 1 ? \276276- ASSERT((d) == XFS_SB_DADDR || \277277- xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \278278- ASSERT(xfs_daddr_to_agno(mp, d) == \279279- xfs_daddr_to_agno(mp, (d) + (len) - 1)))280280-281281-#endif /* __XFS_AG_H__ */
···11-/*22- * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.33- * All Rights Reserved.44- *55- * This program is free software; you can redistribute it and/or66- * modify it under the terms of the GNU General Public License as77- * published by the Free Software Foundation.88- *99- * This program is distributed in the hope that it would be useful,1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212- * GNU General Public License for more details.1313- *1414- * You should have received a copy of the GNU General Public License1515- * along with this program; if not, write the Free Software Foundation,1616- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA1717- */1818-#ifndef __XFS_DINODE_H__1919-#define __XFS_DINODE_H__2020-2121-#define XFS_DINODE_MAGIC 0x494e /* 'IN' */2222-#define XFS_DINODE_GOOD_VERSION(v) ((v) >= 1 && (v) <= 3)2323-2424-typedef struct xfs_timestamp {2525- __be32 t_sec; /* timestamp seconds */2626- __be32 t_nsec; /* timestamp nanoseconds */2727-} xfs_timestamp_t;2828-2929-/*3030- * On-disk inode structure.3131- *3232- * This is just the header or "dinode core", the inode is expanded to fill a3333- * variable size the leftover area split into a data and an attribute fork.3434- * The format of the data and attribute fork depends on the format of the3535- * inode as indicated by di_format and di_aformat. To access the data and3636- * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros3737- * below.3838- *3939- * There is a very similar struct icdinode in xfs_inode which matches the4040- * layout of the first 96 bytes of this structure, but is kept in native4141- * format instead of big endian.4242- *4343- * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed4444- * padding field for v3 inodes.4545- */4646-typedef struct xfs_dinode {4747- __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */4848- __be16 di_mode; /* mode and type of file */4949- __u8 di_version; /* inode version */5050- __u8 di_format; /* format of di_c data */5151- __be16 di_onlink; /* old number of links to file */5252- __be32 di_uid; /* owner's user id */5353- __be32 di_gid; /* owner's group id */5454- __be32 di_nlink; /* number of links to file */5555- __be16 di_projid_lo; /* lower part of owner's project id */5656- __be16 di_projid_hi; /* higher part owner's project id */5757- __u8 di_pad[6]; /* unused, zeroed space */5858- __be16 di_flushiter; /* incremented on flush */5959- xfs_timestamp_t di_atime; /* time last accessed */6060- xfs_timestamp_t di_mtime; /* time last modified */6161- xfs_timestamp_t di_ctime; /* time created/inode modified */6262- __be64 di_size; /* number of bytes in file */6363- __be64 di_nblocks; /* # of direct & btree blocks used */6464- __be32 di_extsize; /* basic/minimum extent size for file */6565- __be32 di_nextents; /* number of extents in data fork */6666- __be16 di_anextents; /* number of extents in attribute fork*/6767- __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */6868- __s8 di_aformat; /* format of attr fork's data */6969- __be32 di_dmevmask; /* DMIG event mask */7070- __be16 di_dmstate; /* DMIG state info */7171- __be16 di_flags; /* random flags, XFS_DIFLAG_... */7272- __be32 di_gen; /* generation number */7373-7474- /* di_next_unlinked is the only non-core field in the old dinode */7575- __be32 di_next_unlinked;/* agi unlinked list ptr */7676-7777- /* start of the extended dinode, writable fields */7878- __le32 di_crc; /* CRC of the inode */7979- __be64 di_changecount; /* number of attribute changes */8080- __be64 di_lsn; /* flush sequence */8181- __be64 di_flags2; /* more random flags */8282- __u8 di_pad2[16]; /* more padding for future expansion */8383-8484- /* fields only written to during inode creation */8585- xfs_timestamp_t di_crtime; /* time created */8686- __be64 di_ino; /* inode number */8787- uuid_t di_uuid; /* UUID of the filesystem */8888-8989- /* structure must be padded to 64 bit alignment */9090-} xfs_dinode_t;9191-9292-#define XFS_DINODE_CRC_OFF offsetof(struct xfs_dinode, di_crc)9393-9494-#define DI_MAX_FLUSH 0xffff9595-9696-/*9797- * Size of the core inode on disk. Version 1 and 2 inodes have9898- * the same size, but version 3 has grown a few additional fields.9999- */100100-static inline uint xfs_dinode_size(int version)101101-{102102- if (version == 3)103103- return sizeof(struct xfs_dinode);104104- return offsetof(struct xfs_dinode, di_crc);105105-}106106-107107-/*108108- * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.109109- * Since the pathconf interface is signed, we use 2^31 - 1 instead.110110- * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.111111- */112112-#define XFS_MAXLINK ((1U << 31) - 1U)113113-#define XFS_MAXLINK_1 65535U114114-115115-/*116116- * Values for di_format117117- */118118-typedef enum xfs_dinode_fmt {119119- XFS_DINODE_FMT_DEV, /* xfs_dev_t */120120- XFS_DINODE_FMT_LOCAL, /* bulk data */121121- XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */122122- XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */123123- XFS_DINODE_FMT_UUID /* uuid_t */124124-} xfs_dinode_fmt_t;125125-126126-/*127127- * Inode minimum and maximum sizes.128128- */129129-#define XFS_DINODE_MIN_LOG 8130130-#define XFS_DINODE_MAX_LOG 11131131-#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)132132-#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)133133-134134-/*135135- * Inode size for given fs.136136- */137137-#define XFS_LITINO(mp, version) \138138- ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))139139-140140-/*141141- * Inode data & attribute fork sizes, per inode.142142- */143143-#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0)144144-#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3))145145-146146-#define XFS_DFORK_DSIZE(dip,mp) \147147- (XFS_DFORK_Q(dip) ? \148148- XFS_DFORK_BOFF(dip) : \149149- XFS_LITINO(mp, (dip)->di_version))150150-#define XFS_DFORK_ASIZE(dip,mp) \151151- (XFS_DFORK_Q(dip) ? \152152- XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \153153- 0)154154-#define XFS_DFORK_SIZE(dip,mp,w) \155155- ((w) == XFS_DATA_FORK ? \156156- XFS_DFORK_DSIZE(dip, mp) : \157157- XFS_DFORK_ASIZE(dip, mp))158158-159159-/*160160- * Return pointers to the data or attribute forks.161161- */162162-#define XFS_DFORK_DPTR(dip) \163163- ((char *)dip + xfs_dinode_size(dip->di_version))164164-#define XFS_DFORK_APTR(dip) \165165- (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))166166-#define XFS_DFORK_PTR(dip,w) \167167- ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))168168-169169-#define XFS_DFORK_FORMAT(dip,w) \170170- ((w) == XFS_DATA_FORK ? \171171- (dip)->di_format : \172172- (dip)->di_aformat)173173-#define XFS_DFORK_NEXTENTS(dip,w) \174174- ((w) == XFS_DATA_FORK ? \175175- be32_to_cpu((dip)->di_nextents) : \176176- be16_to_cpu((dip)->di_anextents))177177-178178-#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr))179179-180180-/*181181- * For block and character special files the 32bit dev_t is stored at the182182- * beginning of the data fork.183183- */184184-static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)185185-{186186- return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));187187-}188188-189189-static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)190190-{191191- *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);192192-}193193-194194-/*195195- * Values for di_flags196196- * There should be a one-to-one correspondence between these flags and the197197- * XFS_XFLAG_s.198198- */199199-#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */200200-#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */201201-#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */202202-#define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */203203-#define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */204204-#define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */205205-#define XFS_DIFLAG_NOATIME_BIT 6 /* do not update atime */206206-#define XFS_DIFLAG_NODUMP_BIT 7 /* do not dump */207207-#define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */208208-#define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */209209-#define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */210210-#define XFS_DIFLAG_EXTSIZE_BIT 11 /* inode extent size allocator hint */211211-#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */212212-#define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */213213-#define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */214214-#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)215215-#define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)216216-#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)217217-#define XFS_DIFLAG_IMMUTABLE (1 << XFS_DIFLAG_IMMUTABLE_BIT)218218-#define XFS_DIFLAG_APPEND (1 << XFS_DIFLAG_APPEND_BIT)219219-#define XFS_DIFLAG_SYNC (1 << XFS_DIFLAG_SYNC_BIT)220220-#define XFS_DIFLAG_NOATIME (1 << XFS_DIFLAG_NOATIME_BIT)221221-#define XFS_DIFLAG_NODUMP (1 << XFS_DIFLAG_NODUMP_BIT)222222-#define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT)223223-#define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT)224224-#define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT)225225-#define XFS_DIFLAG_EXTSIZE (1 << XFS_DIFLAG_EXTSIZE_BIT)226226-#define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)227227-#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)228228-#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)229229-230230-#ifdef CONFIG_XFS_RT231231-#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)232232-#else233233-#define XFS_IS_REALTIME_INODE(ip) (0)234234-#endif235235-236236-#define XFS_DIFLAG_ANY \237237- (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \238238- XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \239239- XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \240240- XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \241241- XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)242242-243243-#endif /* __XFS_DINODE_H__ */
···2121#include "xfs_format.h"2222#include "xfs_log_format.h"2323#include "xfs_trans_resv.h"2424-#include "xfs_sb.h"2525-#include "xfs_ag.h"2624#include "xfs_mount.h"2725#include "xfs_inode.h"2826#include "xfs_error.h"···2830#include "xfs_icache.h"2931#include "xfs_trans.h"3032#include "xfs_ialloc.h"3131-#include "xfs_dinode.h"32333334/*3435 * Check that none of the inode's in the buffer have a next
···11-/*22- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.33- * All Rights Reserved.44- *55- * This program is free software; you can redistribute it and/or66- * modify it under the terms of the GNU General Public License as77- * published by the Free Software Foundation.88- *99- * This program is distributed in the hope that it would be useful,1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212- * GNU General Public License for more details.1313- *1414- * You should have received a copy of the GNU General Public License1515- * along with this program; if not, write the Free Software Foundation,1616- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA1717- */1818-#ifndef __XFS_INUM_H__1919-#define __XFS_INUM_H__2020-2121-/*2222- * Inode number format:2323- * low inopblog bits - offset in block2424- * next agblklog bits - block number in ag2525- * next agno_log bits - ag number2626- * high agno_log-agblklog-inopblog bits - 02727- */2828-2929-struct xfs_mount;3030-3131-#define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)3232-#define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog3333-#define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog3434-#define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log3535-#define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log3636-#define XFS_INO_BITS(mp) \3737- XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)3838-#define XFS_INO_TO_AGNO(mp,i) \3939- ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))4040-#define XFS_INO_TO_AGINO(mp,i) \4141- ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))4242-#define XFS_INO_TO_AGBNO(mp,i) \4343- (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \4444- XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))4545-#define XFS_INO_TO_OFFSET(mp,i) \4646- ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))4747-#define XFS_INO_TO_FSB(mp,i) \4848- XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))4949-#define XFS_AGINO_TO_INO(mp,a,i) \5050- (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))5151-#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))5252-#define XFS_AGINO_TO_OFFSET(mp,i) \5353- ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))5454-#define XFS_OFFBNO_TO_AGINO(mp,b,o) \5555- ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))5656-5757-#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))5858-#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))5959-6060-#endif /* __XFS_INUM_H__ */
+1-1
fs/xfs/libxfs/xfs_log_format.h
···361361362362/*363363 * NOTE: This structure must be kept identical to struct xfs_dinode364364- * in xfs_dinode.h except for the endianness annotations.364364+ * except for the endianness annotations.365365 */366366typedef struct xfs_icdinode {367367 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
···2222struct posix_acl;2323struct xfs_inode;24242525-#define XFS_ACL_NOT_PRESENT (-1)2626-2727-/* On-disk XFS access control list structure */2828-struct xfs_acl_entry {2929- __be32 ae_tag;3030- __be32 ae_id;3131- __be16 ae_perm;3232- __be16 ae_pad; /* fill the implicit hole in the structure */3333-};3434-3535-struct xfs_acl {3636- __be32 acl_cnt;3737- struct xfs_acl_entry acl_entry[0];3838-};3939-4040-/*4141- * The number of ACL entries allowed is defined by the on-disk format.4242- * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is4343- * limited only by the maximum size of the xattr that stores the information.4444- */4545-#define XFS_ACL_MAX_ENTRIES(mp) \4646- (xfs_sb_version_hascrc(&mp->m_sb) \4747- ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \4848- sizeof(struct xfs_acl_entry) \4949- : 25)5050-5151-#define XFS_ACL_MAX_SIZE(mp) \5252- (sizeof(struct xfs_acl) + \5353- sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))5454-5555-/* On-disk XFS extended attribute names */5656-#define SGI_ACL_FILE (unsigned char *)"SGI_ACL_FILE"5757-#define SGI_ACL_DEFAULT (unsigned char *)"SGI_ACL_DEFAULT"5858-#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)5959-#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)6060-6125#ifdef CONFIG_XFS_POSIX_ACL6226extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);6327extern int xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
···3434#define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */35353636/*3737+ * tags for inode radix tree3838+ */3939+#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged lookup4040+ in xfs_inode_ag_iterator */4141+#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */4242+#define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */4343+4444+/*3745 * Flags for xfs_iget()3846 */3947#define XFS_IGET_CREATE 0x1
···321321322322/*323323 * Per-ag incore structure, copies of information in agf and agi, to improve the324324- * performance of allocation group selection. This is defined for the kernel325325- * only, and hence is defined here instead of in xfs_ag.h. You need the struct326326- * xfs_mount to be defined to look up a xfs_perag anyway (via mp->m_perag_tree),327327- * so this doesn't introduce any strange header file dependencies.324324+ * performance of allocation group selection.328325 */329326typedef struct xfs_perag {330327 struct xfs_mount *pag_mount; /* owner filesystem */
-2
fs/xfs/xfs_qm.c
···2323#include "xfs_trans_resv.h"2424#include "xfs_bit.h"2525#include "xfs_sb.h"2626-#include "xfs_ag.h"2726#include "xfs_mount.h"2827#include "xfs_inode.h"2928#include "xfs_ialloc.h"···3738#include "xfs_trace.h"3839#include "xfs_icache.h"3940#include "xfs_cksum.h"4040-#include "xfs_dinode.h"41414242/*4343 * The global quota manager. There is only one of these for the entire