git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
xfs: switch to NOFS allocation under i_lock in xfs_da_state_alloc
[safe/jmp/linux-2.6]
/
fs
/
xfs
/
xfs_da_btree.c
diff --git
a/fs/xfs/xfs_da_btree.c
b/fs/xfs/xfs_da_btree.c
index
edc0aef
..
bd0bb6d
100644
(file)
--- a/
fs/xfs/xfs_da_btree.c
+++ b/
fs/xfs/xfs_da_btree.c
@@
-1503,7
+1503,7
@@
xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
* This is implemented with some source-level loop unrolling.
*/
xfs_dahash_t
* This is implemented with some source-level loop unrolling.
*/
xfs_dahash_t
-xfs_da_hashname(const
uchar
_t *name, int namelen)
+xfs_da_hashname(const
__uint8
_t *name, int namelen)
{
xfs_dahash_t hash;
{
xfs_dahash_t hash;
@@
-1566,11
+1566,14
@@
xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
int nmap, error, w, count, c, got, i, mapi;
xfs_trans_t *tp;
xfs_mount_t *mp;
int nmap, error, w, count, c, got, i, mapi;
xfs_trans_t *tp;
xfs_mount_t *mp;
+ xfs_drfsbno_t nblks;
dp = args->dp;
mp = dp->i_mount;
w = args->whichfork;
tp = args->trans;
dp = args->dp;
mp = dp->i_mount;
w = args->whichfork;
tp = args->trans;
+ nblks = dp->i_d.di_nblocks;
+
/*
* For new directories adjust the file offset and block count.
*/
/*
* For new directories adjust the file offset and block count.
*/
@@
-1594,7
+1597,7
@@
xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
nmap = 1;
ASSERT(args->firstblock != NULL);
if ((error = xfs_bmapi(tp, dp, bno, count,
nmap = 1;
ASSERT(args->firstblock != NULL);
if ((error = xfs_bmapi(tp, dp, bno, count,
-
XFS_BMAPI_AFLAG
(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|
+
xfs_bmapi_aflag
(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|
XFS_BMAPI_CONTIG,
args->firstblock, args->total, &map, &nmap,
args->flist, NULL))) {
XFS_BMAPI_CONTIG,
args->firstblock, args->total, &map, &nmap,
args->flist, NULL))) {
@@
-1615,7
+1618,7
@@
xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
nmap = MIN(XFS_BMAP_MAX_NMAP, count);
c = (int)(bno + count - b);
if ((error = xfs_bmapi(tp, dp, b, c,
nmap = MIN(XFS_BMAP_MAX_NMAP, count);
c = (int)(bno + count - b);
if ((error = xfs_bmapi(tp, dp, b, c,
-
XFS_BMAPI_AFLAG
(w)|XFS_BMAPI_WRITE|
+
xfs_bmapi_aflag
(w)|XFS_BMAPI_WRITE|
XFS_BMAPI_METADATA,
args->firstblock, args->total,
&mapp[mapi], &nmap, args->flist,
XFS_BMAPI_METADATA,
args->firstblock, args->total,
&mapp[mapi], &nmap, args->flist,
@@
-1647,6
+1650,8
@@
xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
}
if (mapp != &map)
kmem_free(mapp);
}
if (mapp != &map)
kmem_free(mapp);
+ /* account for newly allocated blocks in reserved blocks total */
+ args->total -= dp->i_d.di_nblocks - nblks;
*new_blkno = (xfs_dablk_t)bno;
return 0;
}
*new_blkno = (xfs_dablk_t)bno;
return 0;
}
@@
-1877,7
+1882,7
@@
xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
* the last block to the place we want to kill.
*/
if ((error = xfs_bunmapi(tp, dp, dead_blkno, count,
* the last block to the place we want to kill.
*/
if ((error = xfs_bunmapi(tp, dp, dead_blkno, count,
-
XFS_BMAPI_AFLAG
(w)|XFS_BMAPI_METADATA,
+
xfs_bmapi_aflag
(w)|XFS_BMAPI_METADATA,
0, args->firstblock, args->flist, NULL,
&done)) == ENOSPC) {
if (w != XFS_DATA_FORK)
0, args->firstblock, args->flist, NULL,
&done)) == ENOSPC) {
if (w != XFS_DATA_FORK)
@@
-1982,7
+1987,7
@@
xfs_da_do_buf(
if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno,
nfsb,
XFS_BMAPI_METADATA |
if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno,
nfsb,
XFS_BMAPI_METADATA |
-
XFS_BMAPI_AFLAG
(whichfork),
+
xfs_bmapi_aflag
(whichfork),
NULL, 0, mapp, &nmap, NULL, NULL)))
goto exit0;
}
NULL, 0, mapp, &nmap, NULL, NULL)))
goto exit0;
}
@@
-2196,7
+2201,7
@@
kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */
xfs_da_state_t *
xfs_da_state_alloc(void)
{
xfs_da_state_t *
xfs_da_state_alloc(void)
{
- return kmem_zone_zalloc(xfs_da_state_zone, KM_
SLEEP
);
+ return kmem_zone_zalloc(xfs_da_state_zone, KM_
NOFS
);
}
/*
}
/*
@@
-2240,7
+2245,7
@@
xfs_da_state_free(xfs_da_state_t *state)
#ifdef XFS_DABUF_DEBUG
xfs_dabuf_t *xfs_dabuf_global_list;
#ifdef XFS_DABUF_DEBUG
xfs_dabuf_t *xfs_dabuf_global_list;
-s
pinlock_t xfs_dabuf_global_lock
;
+s
tatic DEFINE_SPINLOCK(xfs_dabuf_global_lock)
;
#endif
/*
#endif
/*