Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255161
b: refs/heads/master
c: d0f9e8f
h: refs/heads/master
i:
  255159: dd1171f
v: v3
  • Loading branch information
Christoph Hellwig committed Jul 13, 2011
1 parent 329c53c commit 48c9abb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 68 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: c84470dda7a1165d90f55c2025c4c8ca403d485e
refs/heads/master: d0f9e8fb4cc6dd5d07c72eeecc2f332b6e85e221
68 changes: 12 additions & 56 deletions trunk/fs/xfs/xfs_da_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ STATIC void xfs_da_node_unbalance(xfs_da_state_t *state,
*/
STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count);
STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp);
STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra);
STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps);
STATIC int xfs_da_blk_unlink(xfs_da_state_t *state,
xfs_da_state_blk_t *drop_blk,
xfs_da_state_blk_t *save_blk);
Expand Down Expand Up @@ -1939,8 +1939,7 @@ xfs_da_do_buf(
xfs_daddr_t *mappedbnop,
xfs_dabuf_t **bpp,
int whichfork,
int caller,
inst_t *ra)
int caller)
{
xfs_buf_t *bp = NULL;
xfs_buf_t **bplist;
Expand Down Expand Up @@ -2079,9 +2078,9 @@ xfs_da_do_buf(
* Build a dabuf structure.
*/
if (bplist) {
rbp = xfs_da_buf_make(nbplist, bplist, ra);
rbp = xfs_da_buf_make(nbplist, bplist);
} else if (bp)
rbp = xfs_da_buf_make(1, &bp, ra);
rbp = xfs_da_buf_make(1, &bp);
else
rbp = NULL;
/*
Expand Down Expand Up @@ -2149,8 +2148,7 @@ xfs_da_get_buf(
xfs_dabuf_t **bpp,
int whichfork)
{
return xfs_da_do_buf(trans, dp, bno, &mappedbno, bpp, whichfork, 0,
(inst_t *)__return_address);
return xfs_da_do_buf(trans, dp, bno, &mappedbno, bpp, whichfork, 0);
}

/*
Expand All @@ -2165,8 +2163,7 @@ xfs_da_read_buf(
xfs_dabuf_t **bpp,
int whichfork)
{
return xfs_da_do_buf(trans, dp, bno, &mappedbno, bpp, whichfork, 1,
(inst_t *)__return_address);
return xfs_da_do_buf(trans, dp, bno, &mappedbno, bpp, whichfork, 1);
}

/*
Expand All @@ -2182,8 +2179,7 @@ xfs_da_reada_buf(
xfs_daddr_t rval;

rval = -1;
if (xfs_da_do_buf(trans, dp, bno, &rval, NULL, whichfork, 3,
(inst_t *)__return_address))
if (xfs_da_do_buf(trans, dp, bno, &rval, NULL, whichfork, 3))
return -1;
else
return rval;
Expand Down Expand Up @@ -2241,17 +2237,12 @@ xfs_da_state_free(xfs_da_state_t *state)
kmem_zone_free(xfs_da_state_zone, state);
}

#ifdef XFS_DABUF_DEBUG
xfs_dabuf_t *xfs_dabuf_global_list;
static DEFINE_SPINLOCK(xfs_dabuf_global_lock);
#endif

/*
* Create a dabuf.
*/
/* ARGSUSED */
STATIC xfs_dabuf_t *
xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
xfs_da_buf_make(int nbuf, xfs_buf_t **bps)
{
xfs_buf_t *bp;
xfs_dabuf_t *dabuf;
Expand All @@ -2263,11 +2254,6 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
else
dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_NOFS);
dabuf->dirty = 0;
#ifdef XFS_DABUF_DEBUG
dabuf->ra = ra;
dabuf->target = XFS_BUF_TARGET(bps[0]);
dabuf->blkno = XFS_BUF_ADDR(bps[0]);
#endif
if (nbuf == 1) {
dabuf->nbuf = 1;
bp = bps[0];
Expand All @@ -2287,23 +2273,6 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
XFS_BUF_COUNT(bp));
}
}
#ifdef XFS_DABUF_DEBUG
{
xfs_dabuf_t *p;

spin_lock(&xfs_dabuf_global_lock);
for (p = xfs_dabuf_global_list; p; p = p->next) {
ASSERT(p->blkno != dabuf->blkno ||
p->target != dabuf->target);
}
dabuf->prev = NULL;
if (xfs_dabuf_global_list)
xfs_dabuf_global_list->prev = dabuf;
dabuf->next = xfs_dabuf_global_list;
xfs_dabuf_global_list = dabuf;
spin_unlock(&xfs_dabuf_global_lock);
}
#endif
return dabuf;
}

Expand Down Expand Up @@ -2339,25 +2308,12 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf)
ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]);
if (dabuf->dirty)
xfs_da_buf_clean(dabuf);
if (dabuf->nbuf > 1)
if (dabuf->nbuf > 1) {
kmem_free(dabuf->data);
#ifdef XFS_DABUF_DEBUG
{
spin_lock(&xfs_dabuf_global_lock);
if (dabuf->prev)
dabuf->prev->next = dabuf->next;
else
xfs_dabuf_global_list = dabuf->next;
if (dabuf->next)
dabuf->next->prev = dabuf->prev;
spin_unlock(&xfs_dabuf_global_lock);
}
memset(dabuf, 0, XFS_DA_BUF_SIZE(dabuf->nbuf));
#endif
if (dabuf->nbuf == 1)
kmem_zone_free(xfs_dabuf_zone, dabuf);
else
kmem_free(dabuf);
} else {
kmem_zone_free(xfs_dabuf_zone, dabuf);
}
}

/*
Expand Down
11 changes: 0 additions & 11 deletions trunk/fs/xfs/xfs_da_btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,11 @@ typedef struct xfs_dabuf {
short dirty; /* data needs to be copied back */
short bbcount; /* how large is data in bbs */
void *data; /* pointer for buffers' data */
#ifdef XFS_DABUF_DEBUG
inst_t *ra; /* return address of caller to make */
struct xfs_dabuf *next; /* next in global chain */
struct xfs_dabuf *prev; /* previous in global chain */
struct xfs_buftarg *target; /* device for buffer */
xfs_daddr_t blkno; /* daddr first in bps[0] */
#endif
struct xfs_buf *bps[1]; /* actually nbuf of these */
} xfs_dabuf_t;
#define XFS_DA_BUF_SIZE(n) \
(sizeof(xfs_dabuf_t) + sizeof(struct xfs_buf *) * ((n) - 1))

#ifdef XFS_DABUF_DEBUG
extern xfs_dabuf_t *xfs_dabuf_global_list;
#endif

/*
* Storage for holding state during Btree searches and split/join ops.
*
Expand Down

0 comments on commit 48c9abb

Please sign in to comment.