Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18187
b: refs/heads/master
c: 3762ec6
h: refs/heads/master
i:
  18185: 096e7ba
  18183: a409332
v: v3
  • Loading branch information
Nathan Scott committed Jan 11, 2006
1 parent 9d80c15 commit e996635
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ab65429b4871c42bfd0013f7f5e49d40c0642cd
refs/heads/master: 3762ec6bf76cdd32653c409dbad09f7b85807c68
4 changes: 2 additions & 2 deletions trunk/fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ xfs_qm_dquot_logitem_pushbuf(
* trying to duplicate our effort.
*/
ASSERT(qip->qli_pushbuf_flag != 0);
ASSERT(qip->qli_push_owner == get_thread_id());
ASSERT(qip->qli_push_owner == current_pid());

/*
* If flushlock isn't locked anymore, chances are that the
Expand Down Expand Up @@ -333,7 +333,7 @@ xfs_qm_dquot_logitem_trylock(
qip->qli_pushbuf_flag = 1;
ASSERT(qip->qli_format.qlf_blkno == dqp->q_blkno);
#ifdef DEBUG
qip->qli_push_owner = get_thread_id();
qip->qli_push_owner = current_pid();
#endif
/*
* The dquot is left locked.
Expand Down
58 changes: 24 additions & 34 deletions trunk/fs/xfs/support/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,6 @@ static const char * const err_level[XFS_MAX_ERR_LEVEL+1] =
KERN_ERR, KERN_WARNING, KERN_NOTICE,
KERN_INFO, KERN_DEBUG};

void
assfail(char *a, char *f, int l)
{
printk("XFS assertion failed: %s, file: %s, line: %d\n", a, f, l);
BUG();
}

#if ((defined(DEBUG) || defined(INDUCE_IO_ERRROR)) && !defined(NO_WANT_RANDOM))

unsigned long
random(void)
{
static unsigned long RandomValue = 1;
/* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
register long rv = RandomValue;
register long lo;
register long hi;

hi = rv / 127773;
lo = rv % 127773;
rv = 16807 * lo - 2836 * hi;
if( rv <= 0 ) rv += 2147483647;
return( RandomValue = rv );
}

int
get_thread_id(void)
{
return current->pid;
}

#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */

void
cmn_err(register int level, char *fmt, ...)
{
Expand All @@ -90,7 +57,6 @@ cmn_err(register int level, char *fmt, ...)
BUG();
}


void
icmn_err(register int level, char *fmt, va_list ap)
{
Expand All @@ -109,3 +75,27 @@ icmn_err(register int level, char *fmt, va_list ap)
if (level == CE_PANIC)
BUG();
}

void
assfail(char *expr, char *file, int line)
{
printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line);
BUG();
}

#if ((defined(DEBUG) || defined(INDUCE_IO_ERRROR)) && !defined(NO_WANT_RANDOM))
unsigned long random(void)
{
static unsigned long RandomValue = 1;
/* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
register long rv = RandomValue;
register long lo;
register long hi;

hi = rv / 127773;
lo = rv % 127773;
rv = 16807 * lo - 2836 * hi;
if (rv <= 0) rv += 2147483647;
return RandomValue = rv;
}
#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
25 changes: 12 additions & 13 deletions trunk/fs/xfs/support/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,23 @@ extern void icmn_err(int, char *, va_list)
__attribute__ ((format (printf, 2, 0)));
extern void cmn_err(int, char *, ...)
__attribute__ ((format (printf, 2, 3)));
extern void assfail(char *expr, char *f, int l);

#ifndef STATIC
# define STATIC static
#endif
#define prdev(fmt,targ,args...) \
printk("Device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)

#ifdef DEBUG
# define ASSERT(EX) ((EX) ? ((void)0) : assfail(#EX, __FILE__, __LINE__))
#else
# define ASSERT(x) ((void)0)
#endif
#define ASSERT_ALWAYS(expr) \
(unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__))

extern void assfail(char *, char *, int);
#ifdef DEBUG
#ifndef DEBUG
# define ASSERT(expr) ((void)0)
#else
# define ASSERT(expr) ASSERT_ALWAYS(expr)
extern unsigned long random(void);
extern int get_thread_id(void);
#endif

#define ASSERT_ALWAYS(EX) ((EX)?((void)0):assfail(#EX, __FILE__, __LINE__))
#define debug_stop_all_cpus(param) /* param is "cpumask_t *" */
#ifndef STATIC
# define STATIC static
#endif

#endif /* __XFS_SUPPORT_DEBUG_H__ */
2 changes: 1 addition & 1 deletion trunk/fs/xfs/xfs_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#define cpu_to_be16(val) ((__be16)(val))
#define cpu_to_be32(val) ((__be32)(val))
#define cpu_to_be64(val) ((__be64)(val))
#define be16_to_cpu(val) ((__uint16_t)(val)
#define be16_to_cpu(val) ((__uint16_t)(val))
#define be32_to_cpu(val) ((__uint32_t)(val))
#define be64_to_cpu(val) ((__uint64_t)(val))
#else
Expand Down
79 changes: 43 additions & 36 deletions trunk/fs/xfs/xfs_attr_leaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct xfs_trans;
* the leaf_entry. The namespaces are independent only because we also look
* at the namespace bit when we are looking for a matching attribute name.
*
* We also store a "incomplete" bit in the leaf_entry. It shows that an
* We also store an "incomplete" bit in the leaf_entry. It shows that an
* attribute is in the middle of being created and should not be shown to
* the user if we crash during the time that the bit is set. We clear the
* bit when we have finished setting up the attribute. We do this because
Expand All @@ -72,42 +72,48 @@ struct xfs_trans;
*/
#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */

typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */
__uint16_t base; /* base of free region */
__uint16_t size; /* length of free region */
} xfs_attr_leaf_map_t;

typedef struct xfs_attr_leaf_hdr { /* constant-structure header block */
xfs_da_blkinfo_t info; /* block type, links, etc. */
__uint16_t count; /* count of active leaf_entry's */
__uint16_t usedbytes; /* num bytes of names/values stored */
__uint16_t firstused; /* first used byte in name area */
__uint8_t holes; /* != 0 if blk needs compaction */
__uint8_t pad1;
xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE];
/* N largest free regions */
} xfs_attr_leaf_hdr_t;

typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */
xfs_dahash_t hashval; /* hash value of name */
__uint16_t nameidx; /* index into buffer of name/value */
__uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */
__uint8_t pad2; /* unused pad byte */
} xfs_attr_leaf_entry_t;

typedef struct xfs_attr_leaf_name_local {
__uint16_t valuelen; /* number of bytes in value */
__uint8_t namelen; /* length of name bytes */
__uint8_t nameval[1]; /* name/value bytes */
} xfs_attr_leaf_name_local_t;

typedef struct xfs_attr_leaf_name_remote {
xfs_dablk_t valueblk; /* block number of value bytes */
__uint32_t valuelen; /* number of bytes in value */
__uint8_t namelen; /* length of name bytes */
__uint8_t name[1]; /* name bytes */
} xfs_attr_leaf_name_remote_t;

typedef struct xfs_attr_leafblock {
struct xfs_attr_leaf_hdr { /* constant-structure header block */
xfs_da_blkinfo_t info; /* block type, links, etc. */
__uint16_t count; /* count of active leaf_entry's */
__uint16_t usedbytes; /* num bytes of names/values stored */
__uint16_t firstused; /* first used byte in name area */
__uint8_t holes; /* != 0 if blk needs compaction */
__uint8_t pad1;
struct xfs_attr_leaf_map { /* RLE map of free bytes */
__uint16_t base; /* base of free region */
__uint16_t size; /* length of free region */
} freemap[XFS_ATTR_LEAF_MAPSIZE]; /* N largest free regions */
} hdr;
struct xfs_attr_leaf_entry { /* sorted on key, not name */
xfs_dahash_t hashval; /* hash value of name */
__uint16_t nameidx; /* index into buffer of name/value */
__uint8_t flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag */
__uint8_t pad2; /* unused pad byte */
} entries[1]; /* variable sized array */
struct xfs_attr_leaf_name_local {
__uint16_t valuelen; /* number of bytes in value */
__uint8_t namelen; /* length of name bytes */
__uint8_t nameval[1]; /* name/value bytes */
} namelist; /* grows from bottom of buf */
struct xfs_attr_leaf_name_remote {
xfs_dablk_t valueblk; /* block number of value bytes */
__uint32_t valuelen; /* number of bytes in value */
__uint8_t namelen; /* length of name bytes */
__uint8_t name[1]; /* name bytes */
} valuelist; /* grows from bottom of buf */
xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */
xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */
xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */
xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */
} xfs_attr_leafblock_t;
typedef struct xfs_attr_leaf_hdr xfs_attr_leaf_hdr_t;
typedef struct xfs_attr_leaf_map xfs_attr_leaf_map_t;
typedef struct xfs_attr_leaf_entry xfs_attr_leaf_entry_t;
typedef struct xfs_attr_leaf_name_local xfs_attr_leaf_name_local_t;
typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t;

/*
* Flags used in the leaf_entry[i].flags field.
Expand Down Expand Up @@ -150,7 +156,8 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
(leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)];
}

#define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx)
#define XFS_ATTR_LEAF_NAME(leafp,idx) \
xfs_attr_leaf_name(leafp,idx)
static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
{
return (&((char *)
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4493,8 +4493,8 @@ xfs_bmap_read_extents(
num_recs = be16_to_cpu(block->bb_numrecs);
if (unlikely(i + num_recs > room)) {
ASSERT(i + num_recs <= room);
xfs_fs_cmn_err(CE_WARN, ip->i_mount,
"corrupt dinode %Lu, (btree extents). Unmount and run xfs_repair.",
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
"corrupt dinode %Lu, (btree extents).",
(unsigned long long) ip->i_ino);
XFS_ERROR_REPORT("xfs_bmap_read_extents(1)",
XFS_ERRLEVEL_LOW,
Expand Down
64 changes: 34 additions & 30 deletions trunk/fs/xfs/xfs_dir_leaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,38 @@ struct xfs_trans;
*/
#define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */

typedef struct xfs_dir_leaf_map { /* RLE map of free bytes */
__uint16_t base; /* base of free region */
__uint16_t size; /* run length of free region */
} xfs_dir_leaf_map_t;

typedef struct xfs_dir_leaf_hdr { /* constant-structure header block */
xfs_da_blkinfo_t info; /* block type, links, etc. */
__uint16_t count; /* count of active leaf_entry's */
__uint16_t namebytes; /* num bytes of name strings stored */
__uint16_t firstused; /* first used byte in name area */
__uint8_t holes; /* != 0 if blk needs compaction */
__uint8_t pad1;
xfs_dir_leaf_map_t freemap[XFS_DIR_LEAF_MAPSIZE];
} xfs_dir_leaf_hdr_t;

typedef struct xfs_dir_leaf_entry { /* sorted on key, not name */
xfs_dahash_t hashval; /* hash value of name */
__uint16_t nameidx; /* index into buffer of name */
__uint8_t namelen; /* length of name string */
__uint8_t pad2;
} xfs_dir_leaf_entry_t;

typedef struct xfs_dir_leaf_name {
xfs_dir_ino_t inumber; /* inode number for this key */
__uint8_t name[1]; /* name string itself */
} xfs_dir_leaf_name_t;

typedef struct xfs_dir_leafblock {
struct xfs_dir_leaf_hdr { /* constant-structure header block */
xfs_da_blkinfo_t info; /* block type, links, etc. */
__uint16_t count; /* count of active leaf_entry's */
__uint16_t namebytes; /* num bytes of name strings stored */
__uint16_t firstused; /* first used byte in name area */
__uint8_t holes; /* != 0 if blk needs compaction */
__uint8_t pad1;
struct xfs_dir_leaf_map {/* RLE map of free bytes */
__uint16_t base; /* base of free region */
__uint16_t size; /* run length of free region */
} freemap[XFS_DIR_LEAF_MAPSIZE]; /* N largest free regions */
} hdr;
struct xfs_dir_leaf_entry { /* sorted on key, not name */
xfs_dahash_t hashval; /* hash value of name */
__uint16_t nameidx; /* index into buffer of name */
__uint8_t namelen; /* length of name string */
__uint8_t pad2;
} entries[1]; /* var sized array */
struct xfs_dir_leaf_name {
xfs_dir_ino_t inumber; /* inode number for this key */
__uint8_t name[1]; /* name string itself */
} namelist[1]; /* grows from bottom of buf */
xfs_dir_leaf_hdr_t hdr; /* constant-structure header block */
xfs_dir_leaf_entry_t entries[1]; /* var sized array */
xfs_dir_leaf_name_t namelist[1]; /* grows from bottom of buf */
} xfs_dir_leafblock_t;
typedef struct xfs_dir_leaf_hdr xfs_dir_leaf_hdr_t;
typedef struct xfs_dir_leaf_map xfs_dir_leaf_map_t;
typedef struct xfs_dir_leaf_entry xfs_dir_leaf_entry_t;
typedef struct xfs_dir_leaf_name xfs_dir_leaf_name_t;

/*
* Length of name for which a 512-byte block filesystem
Expand Down Expand Up @@ -126,19 +130,19 @@ typedef union {
#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \
((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash))

typedef struct xfs_dir_put_args
{
typedef struct xfs_dir_put_args {
xfs_dircook_t cook; /* cookie of (next) entry */
xfs_intino_t ino; /* inode number */
struct xfs_dirent *dbp; /* buffer pointer */
struct xfs_dirent *dbp; /* buffer pointer */
char *name; /* directory entry name */
int namelen; /* length of name */
int done; /* output: set if value was stored */
xfs_dir_put_t put; /* put function ptr (i/o) */
struct uio *uio; /* uio control structure */
} xfs_dir_put_args_t;

#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) xfs_dir_leaf_entsize_byname(len)
#define XFS_DIR_LEAF_ENTSIZE_BYNAME(len) \
xfs_dir_leaf_entsize_byname(len)
static inline int xfs_dir_leaf_entsize_byname(int len)
{
return (uint)sizeof(xfs_dir_leaf_name_t)-1 + len;
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/xfs/xfs_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ xfs_error_trap(int e)
if (e != xfs_etrap[i])
continue;
cmn_err(CE_NOTE, "xfs_error_trap: error %d", e);
debug_stop_all_cpus((void *)-1LL);
BUG();
break;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/fs/xfs/xfs_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#ifndef __XFS_ERROR_H__
#define __XFS_ERROR_H__

#define prdev(fmt,targ,args...) \
printk("XFS: device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)

#define XFS_ERECOVER 1 /* Failure to recover log */
#define XFS_ELOGSTAT 2 /* Failure to stat log in user space */
#define XFS_ENOLOGSPACE 3 /* Reservation too large */
Expand Down Expand Up @@ -182,8 +179,11 @@ extern int xfs_errortag_clearall_umount(int64_t fsid, char *fsname, int loud);
struct xfs_mount;
/* PRINTFLIKE4 */
extern void xfs_cmn_err(int panic_tag, int level, struct xfs_mount *mp,
char *fmt, ...);
char *fmt, ...);
/* PRINTFLIKE3 */
extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);

#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)

#endif /* __XFS_ERROR_H__ */
Loading

0 comments on commit e996635

Please sign in to comment.