···63 * the leaf_entry. The namespaces are independent only because we also look64 * at the namespace bit when we are looking for a matching attribute name.65 *66- * We also store a "incomplete" bit in the leaf_entry. It shows that an67 * attribute is in the middle of being created and should not be shown to68 * the user if we crash during the time that the bit is set. We clear the69 * bit when we have finished setting up the attribute. We do this because···72 */73#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */7400000000000000000000000000000000000075typedef struct xfs_attr_leafblock {76- struct xfs_attr_leaf_hdr { /* constant-structure header block */77- xfs_da_blkinfo_t info; /* block type, links, etc. */78- __uint16_t count; /* count of active leaf_entry's */79- __uint16_t usedbytes; /* num bytes of names/values stored */80- __uint16_t firstused; /* first used byte in name area */81- __uint8_t holes; /* != 0 if blk needs compaction */82- __uint8_t pad1;83- struct xfs_attr_leaf_map { /* RLE map of free bytes */84- __uint16_t base; /* base of free region */85- __uint16_t size; /* length of free region */86- } freemap[XFS_ATTR_LEAF_MAPSIZE]; /* N largest free regions */87- } hdr;88- struct xfs_attr_leaf_entry { /* sorted on key, not name */89- xfs_dahash_t hashval; /* hash value of name */90- __uint16_t nameidx; /* index into buffer of name/value */91- __uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */92- __uint8_t pad2; /* unused pad byte */93- } entries[1]; /* variable sized array */94- struct xfs_attr_leaf_name_local {95- __uint16_t valuelen; /* number of bytes in value */96- __uint8_t namelen; /* length of name bytes */97- __uint8_t nameval[1]; /* name/value bytes */98- } namelist; /* grows from bottom of buf */99- struct xfs_attr_leaf_name_remote {100- xfs_dablk_t valueblk; /* block number of value bytes */101- __uint32_t valuelen; /* number of bytes in value */102- __uint8_t namelen; /* length of name bytes */103- __uint8_t name[1]; /* name bytes */104- } valuelist; /* grows from bottom of buf */105} xfs_attr_leafblock_t;106-typedef struct xfs_attr_leaf_hdr xfs_attr_leaf_hdr_t;107-typedef struct xfs_attr_leaf_map xfs_attr_leaf_map_t;108-typedef struct xfs_attr_leaf_entry xfs_attr_leaf_entry_t;109-typedef struct xfs_attr_leaf_name_local xfs_attr_leaf_name_local_t;110-typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t;111112/*113 * Flags used in the leaf_entry[i].flags field.···156 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];157}158159-#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx)0160static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)161{162 return (&((char *)
···63 * the leaf_entry. The namespaces are independent only because we also look64 * at the namespace bit when we are looking for a matching attribute name.65 *66+ * We also store an "incomplete" bit in the leaf_entry. It shows that an67 * attribute is in the middle of being created and should not be shown to68 * the user if we crash during the time that the bit is set. We clear the69 * bit when we have finished setting up the attribute. We do this because···72 */73#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */7475+typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */76+ __uint16_t base; /* base of free region */77+ __uint16_t size; /* length of free region */78+} xfs_attr_leaf_map_t;79+80+typedef struct xfs_attr_leaf_hdr { /* constant-structure header block */81+ xfs_da_blkinfo_t info; /* block type, links, etc. */82+ __uint16_t count; /* count of active leaf_entry's */83+ __uint16_t usedbytes; /* num bytes of names/values stored */84+ __uint16_t firstused; /* first used byte in name area */85+ __uint8_t holes; /* != 0 if blk needs compaction */86+ __uint8_t pad1;87+ xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE];88+ /* N largest free regions */89+} xfs_attr_leaf_hdr_t;90+91+typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */92+ xfs_dahash_t hashval; /* hash value of name */93+ __uint16_t nameidx; /* index into buffer of name/value */94+ __uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */95+ __uint8_t pad2; /* unused pad byte */96+} xfs_attr_leaf_entry_t;97+98+typedef struct xfs_attr_leaf_name_local {99+ __uint16_t valuelen; /* number of bytes in value */100+ __uint8_t namelen; /* length of name bytes */101+ __uint8_t nameval[1]; /* name/value bytes */102+} xfs_attr_leaf_name_local_t;103+104+typedef struct xfs_attr_leaf_name_remote {105+ xfs_dablk_t valueblk; /* block number of value bytes */106+ __uint32_t valuelen; /* number of bytes in value */107+ __uint8_t namelen; /* length of name bytes */108+ __uint8_t name[1]; /* name bytes */109+} xfs_attr_leaf_name_remote_t;110+111typedef struct xfs_attr_leafblock {112+ xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */113+ xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */114+ xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */115+ xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */0000000000000000000000000116} xfs_attr_leafblock_t;00000117118/*119 * Flags used in the leaf_entry[i].flags field.···150 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];151}152153+#define XFS_ATTR_LEAF_NAME(leafp,idx) \154+ xfs_attr_leaf_name(leafp,idx)155static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)156{157 return (&((char *)
+2-2
fs/xfs/xfs_bmap.c
···4493 num_recs = be16_to_cpu(block->bb_numrecs);4494 if (unlikely(i + num_recs > room)) {4495 ASSERT(i + num_recs <= room);4496- xfs_fs_cmn_err(CE_WARN, ip->i_mount,4497- "corrupt dinode %Lu, (btree extents). Unmount and run xfs_repair.",4498 (unsigned long long) ip->i_ino);4499 XFS_ERROR_REPORT("xfs_bmap_read_extents(1)",4500 XFS_ERRLEVEL_LOW,
···67 */68#define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */6900000000000000000000000000070typedef struct xfs_dir_leafblock {71- struct xfs_dir_leaf_hdr { /* constant-structure header block */72- xfs_da_blkinfo_t info; /* block type, links, etc. */73- __uint16_t count; /* count of active leaf_entry's */74- __uint16_t namebytes; /* num bytes of name strings stored */75- __uint16_t firstused; /* first used byte in name area */76- __uint8_t holes; /* != 0 if blk needs compaction */77- __uint8_t pad1;78- struct xfs_dir_leaf_map {/* RLE map of free bytes */79- __uint16_t base; /* base of free region */80- __uint16_t size; /* run length of free region */81- } freemap[XFS_DIR_LEAF_MAPSIZE]; /* N largest free regions */82- } hdr;83- struct xfs_dir_leaf_entry { /* sorted on key, not name */84- xfs_dahash_t hashval; /* hash value of name */85- __uint16_t nameidx; /* index into buffer of name */86- __uint8_t namelen; /* length of name string */87- __uint8_t pad2;88- } entries[1]; /* var sized array */89- struct xfs_dir_leaf_name {90- xfs_dir_ino_t inumber; /* inode number for this key */91- __uint8_t name[1]; /* name string itself */92- } namelist[1]; /* grows from bottom of buf */93} xfs_dir_leafblock_t;94-typedef struct xfs_dir_leaf_hdr xfs_dir_leaf_hdr_t;95-typedef struct xfs_dir_leaf_map xfs_dir_leaf_map_t;96-typedef struct xfs_dir_leaf_entry xfs_dir_leaf_entry_t;97-typedef struct xfs_dir_leaf_name xfs_dir_leaf_name_t;9899/*100 * Length of name for which a 512-byte block filesystem···130#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \131 ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash))132133-typedef struct xfs_dir_put_args134-{135 xfs_dircook_t cook; /* cookie of (next) entry */136 xfs_intino_t ino; /* inode number */137- struct xfs_dirent *dbp; /* buffer pointer */138 char *name; /* directory entry name */139 int namelen; /* length of name */140 int done; /* output: set if value was stored */···141 struct uio *uio; /* uio control structure */142} xfs_dir_put_args_t;143144-#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len)0145static inline int xfs_dir_leaf_entsize_byname(int len)146{147 return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
···67 */68#define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */6970+typedef struct xfs_dir_leaf_map { /* RLE map of free bytes */71+ __uint16_t base; /* base of free region */72+ __uint16_t size; /* run length of free region */73+} xfs_dir_leaf_map_t;74+75+typedef struct xfs_dir_leaf_hdr { /* constant-structure header block */76+ xfs_da_blkinfo_t info; /* block type, links, etc. */77+ __uint16_t count; /* count of active leaf_entry's */78+ __uint16_t namebytes; /* num bytes of name strings stored */79+ __uint16_t firstused; /* first used byte in name area */80+ __uint8_t holes; /* != 0 if blk needs compaction */81+ __uint8_t pad1;82+ xfs_dir_leaf_map_t freemap[XFS_DIR_LEAF_MAPSIZE];83+} xfs_dir_leaf_hdr_t;84+85+typedef struct xfs_dir_leaf_entry { /* sorted on key, not name */86+ xfs_dahash_t hashval; /* hash value of name */87+ __uint16_t nameidx; /* index into buffer of name */88+ __uint8_t namelen; /* length of name string */89+ __uint8_t pad2;90+} xfs_dir_leaf_entry_t;91+92+typedef struct xfs_dir_leaf_name {93+ xfs_dir_ino_t inumber; /* inode number for this key */94+ __uint8_t name[1]; /* name string itself */95+} xfs_dir_leaf_name_t;96+97typedef struct xfs_dir_leafblock {98+ xfs_dir_leaf_hdr_t hdr; /* constant-structure header block */99+ xfs_dir_leaf_entry_t entries[1]; /* var sized array */100+ xfs_dir_leaf_name_t namelist[1]; /* grows from bottom of buf */0000000000000000000101} xfs_dir_leafblock_t;0000102103/*104 * Length of name for which a 512-byte block filesystem···126#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \127 ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash))128129+typedef struct xfs_dir_put_args {0130 xfs_dircook_t cook; /* cookie of (next) entry */131 xfs_intino_t ino; /* inode number */132+ struct xfs_dirent *dbp; /* buffer pointer */133 char *name; /* directory entry name */134 int namelen; /* length of name */135 int done; /* output: set if value was stored */···138 struct uio *uio; /* uio control structure */139} xfs_dir_put_args_t;140141+#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) \142+ xfs_dir_leaf_entsize_byname(len)143static inline int xfs_dir_leaf_entsize_byname(int len)144{145 return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
-1
fs/xfs/xfs_error.c
···54 if (e != xfs_etrap[i])55 continue;56 cmn_err(CE_NOTE, "xfs_error_trap: error %d", e);57- debug_stop_all_cpus((void *)-1LL);58 BUG();59 break;60 }
···54 if (e != xfs_etrap[i])55 continue;56 cmn_err(CE_NOTE, "xfs_error_trap: error %d", e);057 BUG();58 break;59 }
+4-4
fs/xfs/xfs_error.h
···18#ifndef __XFS_ERROR_H__19#define __XFS_ERROR_H__2021-#define prdev(fmt,targ,args...) \22- printk("XFS: device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)23-24#define XFS_ERECOVER 1 /* Failure to recover log */25#define XFS_ELOGSTAT 2 /* Failure to stat log in user space */26#define XFS_ENOLOGSPACE 3 /* Reservation too large */···179struct xfs_mount;180/* PRINTFLIKE4 */181extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,182- char *fmt, ...);183/* PRINTFLIKE3 */184extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);000185186#endif /* __XFS_ERROR_H__ */
···18#ifndef __XFS_ERROR_H__19#define __XFS_ERROR_H__2000021#define XFS_ERECOVER 1 /* Failure to recover log */22#define XFS_ELOGSTAT 2 /* Failure to stat log in user space */23#define XFS_ENOLOGSPACE 3 /* Reservation too large */···182struct xfs_mount;183/* PRINTFLIKE4 */184extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,185+ char *fmt, ...);186/* PRINTFLIKE3 */187extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);188+189+#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \190+ xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)191192#endif /* __XFS_ERROR_H__ */
+17-16
fs/xfs/xfs_inode.c
···404 INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) +405 INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) >406 INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT))) {407- xfs_fs_cmn_err(CE_WARN, ip->i_mount,408- "corrupt dinode %Lu, extent total = %d, nblocks = %Lu."409- " Unmount and run xfs_repair.",410 (unsigned long long)ip->i_ino,411 (int)(INT_GET(dip->di_core.di_nextents, ARCH_CONVERT)412 + INT_GET(dip->di_core.di_anextents, ARCH_CONVERT)),···417 }418419 if (unlikely(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT) > ip->i_mount->m_sb.sb_inodesize)) {420- xfs_fs_cmn_err(CE_WARN, ip->i_mount,421- "corrupt dinode %Lu, forkoff = 0x%x."422- " Unmount and run xfs_repair.",423 (unsigned long long)ip->i_ino,424 (int)(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT)));425 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,···449 * no local regular files yet450 */451 if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG)) {452- xfs_fs_cmn_err(CE_WARN, ip->i_mount,453- "corrupt inode (local format for regular file) %Lu. Unmount and run xfs_repair.",0454 (unsigned long long) ip->i_ino);455 XFS_CORRUPTION_ERROR("xfs_iformat(4)",456 XFS_ERRLEVEL_LOW,···461462 di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT);463 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {464- xfs_fs_cmn_err(CE_WARN, ip->i_mount,465- "corrupt inode %Lu (bad size %Ld for local inode). Unmount and run xfs_repair.",0466 (unsigned long long) ip->i_ino,467 (long long) di_size);468 XFS_CORRUPTION_ERROR("xfs_iformat(5)",···551 * kmem_alloc() or memcpy() below.552 */553 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {554- xfs_fs_cmn_err(CE_WARN, ip->i_mount,555- "corrupt inode %Lu (bad size %d for local fork, size = %d). Unmount and run xfs_repair.",0556 (unsigned long long) ip->i_ino, size,557 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));558 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,···611 * kmem_alloc() or memcpy() below.612 */613 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {614- xfs_fs_cmn_err(CE_WARN, ip->i_mount,615- "corrupt inode %Lu ((a)extents = %d). Unmount and run xfs_repair.",616 (unsigned long long) ip->i_ino, nex);617 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,618 ip->i_mount, dip);···693 || XFS_BMDR_SPACE_CALC(nrecs) >694 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)695 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {696- xfs_fs_cmn_err(CE_WARN, ip->i_mount,697- "corrupt inode %Lu (btree). Unmount and run xfs_repair.",698 (unsigned long long) ip->i_ino);699 XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW,700 ip->i_mount);
···404 INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) +405 INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) >406 INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT))) {407+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,408+ "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",0409 (unsigned long long)ip->i_ino,410 (int)(INT_GET(dip->di_core.di_nextents, ARCH_CONVERT)411 + INT_GET(dip->di_core.di_anextents, ARCH_CONVERT)),···418 }419420 if (unlikely(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT) > ip->i_mount->m_sb.sb_inodesize)) {421+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,422+ "corrupt dinode %Lu, forkoff = 0x%x.",0423 (unsigned long long)ip->i_ino,424 (int)(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT)));425 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,···451 * no local regular files yet452 */453 if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG)) {454+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,455+ "corrupt inode %Lu "456+ "(local format for regular file).",457 (unsigned long long) ip->i_ino);458 XFS_CORRUPTION_ERROR("xfs_iformat(4)",459 XFS_ERRLEVEL_LOW,···462463 di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT);464 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {465+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,466+ "corrupt inode %Lu "467+ "(bad size %Ld for local inode).",468 (unsigned long long) ip->i_ino,469 (long long) di_size);470 XFS_CORRUPTION_ERROR("xfs_iformat(5)",···551 * kmem_alloc() or memcpy() below.552 */553 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {554+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,555+ "corrupt inode %Lu "556+ "(bad size %d for local fork, size = %d).",557 (unsigned long long) ip->i_ino, size,558 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));559 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,···610 * kmem_alloc() or memcpy() below.611 */612 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {613+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,614+ "corrupt inode %Lu ((a)extents = %d).",615 (unsigned long long) ip->i_ino, nex);616 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,617 ip->i_mount, dip);···692 || XFS_BMDR_SPACE_CALC(nrecs) >693 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)694 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {695+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,696+ "corrupt inode %Lu (btree).",697 (unsigned long long) ip->i_ino);698 XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW,699 ip->i_mount);
+2-2
fs/xfs/xfs_inode_item.c
···608 if (iip->ili_pushbuf_flag == 0) {609 iip->ili_pushbuf_flag = 1;610#ifdef DEBUG611- iip->ili_push_owner = get_thread_id();612#endif613 /*614 * Inode is left locked in shared mode.···787 * trying to duplicate our effort.788 */789 ASSERT(iip->ili_pushbuf_flag != 0);790- ASSERT(iip->ili_push_owner == get_thread_id());791792 /*793 * If flushlock isn't locked anymore, chances are that the
···608 if (iip->ili_pushbuf_flag == 0) {609 iip->ili_pushbuf_flag = 1;610#ifdef DEBUG611+ iip->ili_push_owner = current_pid();612#endif613 /*614 * Inode is left locked in shared mode.···787 * trying to duplicate our effort.788 */789 ASSERT(iip->ili_pushbuf_flag != 0);790+ ASSERT(iip->ili_push_owner == current_pid());791792 /*793 * If flushlock isn't locked anymore, chances are that the