···6363 * the leaf_entry. The namespaces are independent only because we also look6464 * at the namespace bit when we are looking for a matching attribute name.6565 *6666- * We also store a "incomplete" bit in the leaf_entry. It shows that an6666+ * We also store an "incomplete" bit in the leaf_entry. It shows that an6767 * attribute is in the middle of being created and should not be shown to6868 * the user if we crash during the time that the bit is set. We clear the6969 * bit when we have finished setting up the attribute. We do this because···7272 */7373#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */74747575+typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */7676+ __uint16_t base; /* base of free region */7777+ __uint16_t size; /* length of free region */7878+} xfs_attr_leaf_map_t;7979+8080+typedef struct xfs_attr_leaf_hdr { /* constant-structure header block */8181+ xfs_da_blkinfo_t info; /* block type, links, etc. */8282+ __uint16_t count; /* count of active leaf_entry's */8383+ __uint16_t usedbytes; /* num bytes of names/values stored */8484+ __uint16_t firstused; /* first used byte in name area */8585+ __uint8_t holes; /* != 0 if blk needs compaction */8686+ __uint8_t pad1;8787+ xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE];8888+ /* N largest free regions */8989+} xfs_attr_leaf_hdr_t;9090+9191+typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */9292+ xfs_dahash_t hashval; /* hash value of name */9393+ __uint16_t nameidx; /* index into buffer of name/value */9494+ __uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */9595+ __uint8_t pad2; /* unused pad byte */9696+} xfs_attr_leaf_entry_t;9797+9898+typedef struct xfs_attr_leaf_name_local {9999+ __uint16_t valuelen; /* number of bytes in value */100100+ __uint8_t namelen; /* length of name bytes */101101+ __uint8_t nameval[1]; /* name/value bytes */102102+} xfs_attr_leaf_name_local_t;103103+104104+typedef struct xfs_attr_leaf_name_remote {105105+ xfs_dablk_t valueblk; /* block number of value bytes */106106+ __uint32_t valuelen; /* number of bytes in value */107107+ __uint8_t namelen; /* length of name bytes */108108+ __uint8_t name[1]; /* name bytes */109109+} xfs_attr_leaf_name_remote_t;110110+75111typedef struct xfs_attr_leafblock {7676- struct xfs_attr_leaf_hdr { /* constant-structure header block */7777- xfs_da_blkinfo_t info; /* block type, links, etc. */7878- __uint16_t count; /* count of active leaf_entry's */7979- __uint16_t usedbytes; /* num bytes of names/values stored */8080- __uint16_t firstused; /* first used byte in name area */8181- __uint8_t holes; /* != 0 if blk needs compaction */8282- __uint8_t pad1;8383- struct xfs_attr_leaf_map { /* RLE map of free bytes */8484- __uint16_t base; /* base of free region */8585- __uint16_t size; /* length of free region */8686- } freemap[XFS_ATTR_LEAF_MAPSIZE]; /* N largest free regions */8787- } hdr;8888- struct xfs_attr_leaf_entry { /* sorted on key, not name */8989- xfs_dahash_t hashval; /* hash value of name */9090- __uint16_t nameidx; /* index into buffer of name/value */9191- __uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */9292- __uint8_t pad2; /* unused pad byte */9393- } entries[1]; /* variable sized array */9494- struct xfs_attr_leaf_name_local {9595- __uint16_t valuelen; /* number of bytes in value */9696- __uint8_t namelen; /* length of name bytes */9797- __uint8_t nameval[1]; /* name/value bytes */9898- } namelist; /* grows from bottom of buf */9999- struct xfs_attr_leaf_name_remote {100100- xfs_dablk_t valueblk; /* block number of value bytes */101101- __uint32_t valuelen; /* number of bytes in value */102102- __uint8_t namelen; /* length of name bytes */103103- __uint8_t name[1]; /* name bytes */104104- } valuelist; /* grows from bottom of buf */112112+ xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */113113+ xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */114114+ xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */115115+ xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */105116} xfs_attr_leafblock_t;106106-typedef struct xfs_attr_leaf_hdr xfs_attr_leaf_hdr_t;107107-typedef struct xfs_attr_leaf_map xfs_attr_leaf_map_t;108108-typedef struct xfs_attr_leaf_entry xfs_attr_leaf_entry_t;109109-typedef struct xfs_attr_leaf_name_local xfs_attr_leaf_name_local_t;110110-typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t;111117112118/*113119 * Flags used in the leaf_entry[i].flags field.···156150 (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];157151}158152159159-#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx)153153+#define XFS_ATTR_LEAF_NAME(leafp,idx) \154154+ xfs_attr_leaf_name(leafp,idx)160155static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)161156{162157 return (&((char *)
+2-2
fs/xfs/xfs_bmap.c
···44934493 num_recs = be16_to_cpu(block->bb_numrecs);44944494 if (unlikely(i + num_recs > room)) {44954495 ASSERT(i + num_recs <= room);44964496- xfs_fs_cmn_err(CE_WARN, ip->i_mount,44974497- "corrupt dinode %Lu, (btree extents). Unmount and run xfs_repair.",44964496+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,44974497+ "corrupt dinode %Lu, (btree extents).",44984498 (unsigned long long) ip->i_ino);44994499 XFS_ERROR_REPORT("xfs_bmap_read_extents(1)",45004500 XFS_ERRLEVEL_LOW,
+34-30
fs/xfs/xfs_dir_leaf.h
···6767 */6868#define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */69697070+typedef struct xfs_dir_leaf_map { /* RLE map of free bytes */7171+ __uint16_t base; /* base of free region */7272+ __uint16_t size; /* run length of free region */7373+} xfs_dir_leaf_map_t;7474+7575+typedef struct xfs_dir_leaf_hdr { /* constant-structure header block */7676+ xfs_da_blkinfo_t info; /* block type, links, etc. */7777+ __uint16_t count; /* count of active leaf_entry's */7878+ __uint16_t namebytes; /* num bytes of name strings stored */7979+ __uint16_t firstused; /* first used byte in name area */8080+ __uint8_t holes; /* != 0 if blk needs compaction */8181+ __uint8_t pad1;8282+ xfs_dir_leaf_map_t freemap[XFS_DIR_LEAF_MAPSIZE];8383+} xfs_dir_leaf_hdr_t;8484+8585+typedef struct xfs_dir_leaf_entry { /* sorted on key, not name */8686+ xfs_dahash_t hashval; /* hash value of name */8787+ __uint16_t nameidx; /* index into buffer of name */8888+ __uint8_t namelen; /* length of name string */8989+ __uint8_t pad2;9090+} xfs_dir_leaf_entry_t;9191+9292+typedef struct xfs_dir_leaf_name {9393+ xfs_dir_ino_t inumber; /* inode number for this key */9494+ __uint8_t name[1]; /* name string itself */9595+} xfs_dir_leaf_name_t;9696+7097typedef struct xfs_dir_leafblock {7171- struct xfs_dir_leaf_hdr { /* constant-structure header block */7272- xfs_da_blkinfo_t info; /* block type, links, etc. */7373- __uint16_t count; /* count of active leaf_entry's */7474- __uint16_t namebytes; /* num bytes of name strings stored */7575- __uint16_t firstused; /* first used byte in name area */7676- __uint8_t holes; /* != 0 if blk needs compaction */7777- __uint8_t pad1;7878- struct xfs_dir_leaf_map {/* RLE map of free bytes */7979- __uint16_t base; /* base of free region */8080- __uint16_t size; /* run length of free region */8181- } freemap[XFS_DIR_LEAF_MAPSIZE]; /* N largest free regions */8282- } hdr;8383- struct xfs_dir_leaf_entry { /* sorted on key, not name */8484- xfs_dahash_t hashval; /* hash value of name */8585- __uint16_t nameidx; /* index into buffer of name */8686- __uint8_t namelen; /* length of name string */8787- __uint8_t pad2;8888- } entries[1]; /* var sized array */8989- struct xfs_dir_leaf_name {9090- xfs_dir_ino_t inumber; /* inode number for this key */9191- __uint8_t name[1]; /* name string itself */9292- } namelist[1]; /* grows from bottom of buf */9898+ xfs_dir_leaf_hdr_t hdr; /* constant-structure header block */9999+ xfs_dir_leaf_entry_t entries[1]; /* var sized array */100100+ xfs_dir_leaf_name_t namelist[1]; /* grows from bottom of buf */93101} xfs_dir_leafblock_t;9494-typedef struct xfs_dir_leaf_hdr xfs_dir_leaf_hdr_t;9595-typedef struct xfs_dir_leaf_map xfs_dir_leaf_map_t;9696-typedef struct xfs_dir_leaf_entry xfs_dir_leaf_entry_t;9797-typedef struct xfs_dir_leaf_name xfs_dir_leaf_name_t;9810299103/*100104 * Length of name for which a 512-byte block filesystem···130126#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \131127 ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash))132128133133-typedef struct xfs_dir_put_args134134-{129129+typedef struct xfs_dir_put_args {135130 xfs_dircook_t cook; /* cookie of (next) entry */136131 xfs_intino_t ino; /* inode number */137137- struct xfs_dirent *dbp; /* buffer pointer */132132+ struct xfs_dirent *dbp; /* buffer pointer */138133 char *name; /* directory entry name */139134 int namelen; /* length of name */140135 int done; /* output: set if value was stored */···141138 struct uio *uio; /* uio control structure */142139} xfs_dir_put_args_t;143140144144-#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len)141141+#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) \142142+ xfs_dir_leaf_entsize_byname(len)145143static inline int xfs_dir_leaf_entsize_byname(int len)146144{147145 return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
-1
fs/xfs/xfs_error.c
···5454 if (e != xfs_etrap[i])5555 continue;5656 cmn_err(CE_NOTE, "xfs_error_trap: error %d", e);5757- debug_stop_all_cpus((void *)-1LL);5857 BUG();5958 break;6059 }
+4-4
fs/xfs/xfs_error.h
···1818#ifndef __XFS_ERROR_H__1919#define __XFS_ERROR_H__20202121-#define prdev(fmt,targ,args...) \2222- printk("XFS: device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)2323-2421#define XFS_ERECOVER 1 /* Failure to recover log */2522#define XFS_ELOGSTAT 2 /* Failure to stat log in user space */2623#define XFS_ENOLOGSPACE 3 /* Reservation too large */···179182struct xfs_mount;180183/* PRINTFLIKE4 */181184extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,182182- char *fmt, ...);185185+ char *fmt, ...);183186/* PRINTFLIKE3 */184187extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);188188+189189+#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \190190+ xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)185191186192#endif /* __XFS_ERROR_H__ */
+17-16
fs/xfs/xfs_inode.c
···404404 INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) +405405 INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) >406406 INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT))) {407407- xfs_fs_cmn_err(CE_WARN, ip->i_mount,408408- "corrupt dinode %Lu, extent total = %d, nblocks = %Lu."409409- " Unmount and run xfs_repair.",407407+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,408408+ "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",410409 (unsigned long long)ip->i_ino,411410 (int)(INT_GET(dip->di_core.di_nextents, ARCH_CONVERT)412411 + INT_GET(dip->di_core.di_anextents, ARCH_CONVERT)),···417418 }418419419420 if (unlikely(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT) > ip->i_mount->m_sb.sb_inodesize)) {420420- xfs_fs_cmn_err(CE_WARN, ip->i_mount,421421- "corrupt dinode %Lu, forkoff = 0x%x."422422- " Unmount and run xfs_repair.",421421+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,422422+ "corrupt dinode %Lu, forkoff = 0x%x.",423423 (unsigned long long)ip->i_ino,424424 (int)(INT_GET(dip->di_core.di_forkoff, ARCH_CONVERT)));425425 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,···449451 * no local regular files yet450452 */451453 if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG)) {452452- xfs_fs_cmn_err(CE_WARN, ip->i_mount,453453- "corrupt inode (local format for regular file) %Lu. Unmount and run xfs_repair.",454454+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,455455+ "corrupt inode %Lu "456456+ "(local format for regular file).",454457 (unsigned long long) ip->i_ino);455458 XFS_CORRUPTION_ERROR("xfs_iformat(4)",456459 XFS_ERRLEVEL_LOW,···461462462463 di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT);463464 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {464464- xfs_fs_cmn_err(CE_WARN, ip->i_mount,465465- "corrupt inode %Lu (bad size %Ld for local inode). Unmount and run xfs_repair.",465465+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,466466+ "corrupt inode %Lu "467467+ "(bad size %Ld for local inode).",466468 (unsigned long long) ip->i_ino,467469 (long long) di_size);468470 XFS_CORRUPTION_ERROR("xfs_iformat(5)",···551551 * kmem_alloc() or memcpy() below.552552 */553553 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {554554- xfs_fs_cmn_err(CE_WARN, ip->i_mount,555555- "corrupt inode %Lu (bad size %d for local fork, size = %d). Unmount and run xfs_repair.",554554+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,555555+ "corrupt inode %Lu "556556+ "(bad size %d for local fork, size = %d).",556557 (unsigned long long) ip->i_ino, size,557558 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));558559 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,···611610 * kmem_alloc() or memcpy() below.612611 */613612 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {614614- xfs_fs_cmn_err(CE_WARN, ip->i_mount,615615- "corrupt inode %Lu ((a)extents = %d). Unmount and run xfs_repair.",613613+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,614614+ "corrupt inode %Lu ((a)extents = %d).",616615 (unsigned long long) ip->i_ino, nex);617616 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,618617 ip->i_mount, dip);···693692 || XFS_BMDR_SPACE_CALC(nrecs) >694693 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)695694 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {696696- xfs_fs_cmn_err(CE_WARN, ip->i_mount,697697- "corrupt inode %Lu (btree). Unmount and run xfs_repair.",695695+ xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,696696+ "corrupt inode %Lu (btree).",698697 (unsigned long long) ip->i_ino);699698 XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW,700699 ip->i_mount);
+2-2
fs/xfs/xfs_inode_item.c
···608608 if (iip->ili_pushbuf_flag == 0) {609609 iip->ili_pushbuf_flag = 1;610610#ifdef DEBUG611611- iip->ili_push_owner = get_thread_id();611611+ iip->ili_push_owner = current_pid();612612#endif613613 /*614614 * Inode is left locked in shared mode.···787787 * trying to duplicate our effort.788788 */789789 ASSERT(iip->ili_pushbuf_flag != 0);790790- ASSERT(iip->ili_push_owner == get_thread_id());790790+ ASSERT(iip->ili_push_owner == current_pid());791791792792 /*793793 * If flushlock isn't locked anymore, chances are that the