diff options
| -rw-r--r-- | fs/xfs/xfs_alloc.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_attr.c | 9 | ||||
| -rw-r--r-- | fs/xfs/xfs_bmap.c | 118 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf_item.c | 118 | ||||
| -rw-r--r-- | fs/xfs/xfs_buf_item.h | 14 | ||||
| -rw-r--r-- | fs/xfs/xfs_dquot.c | 12 | ||||
| -rw-r--r-- | fs/xfs/xfs_fsops.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_ialloc.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.h | 1 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode_item.c | 16 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode_item.h | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_iomap.c | 77 | ||||
| -rw-r--r-- | fs/xfs/xfs_log.c | 10 | ||||
| -rw-r--r-- | fs/xfs/xfs_mount.c | 12 | ||||
| -rw-r--r-- | fs/xfs/xfs_mount.h | 9 | ||||
| -rw-r--r-- | fs/xfs/xfs_qm.c | 7 | ||||
| -rw-r--r-- | fs/xfs/xfs_qm_bhv.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 28 | ||||
| -rw-r--r-- | fs/xfs/xfs_super.c | 29 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans.c | 376 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans.h | 18 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans_ail.c | 14 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans_dquot.c | 10 | ||||
| -rw-r--r-- | fs/xfs/xfs_trans_inode.c | 41 | ||||
| -rw-r--r-- | fs/xfs/xfs_types.h | 1 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 12 |
28 files changed, 503 insertions, 453 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 393055fe3aef..0ad23253e8b1 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
| @@ -1925,8 +1925,6 @@ xfs_alloc_fix_freelist( | |||
| 1925 | targs.mp = mp; | 1925 | targs.mp = mp; |
| 1926 | targs.agbp = agbp; | 1926 | targs.agbp = agbp; |
| 1927 | targs.agno = args->agno; | 1927 | targs.agno = args->agno; |
| 1928 | targs.mod = targs.minleft = targs.wasdel = targs.userdata = | ||
| 1929 | targs.minalignslop = 0; | ||
| 1930 | targs.alignment = targs.minlen = targs.prod = targs.isfl = 1; | 1928 | targs.alignment = targs.minlen = targs.prod = targs.isfl = 1; |
| 1931 | targs.type = XFS_ALLOCTYPE_THIS_AG; | 1929 | targs.type = XFS_ALLOCTYPE_THIS_AG; |
| 1932 | targs.pag = pag; | 1930 | targs.pag = pag; |
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index aaf472532b3c..888683844d98 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
| @@ -300,9 +300,12 @@ xfs_attr_set_int( | |||
| 300 | if (rsvd) | 300 | if (rsvd) |
| 301 | args.trans->t_flags |= XFS_TRANS_RESERVE; | 301 | args.trans->t_flags |= XFS_TRANS_RESERVE; |
| 302 | 302 | ||
| 303 | if ((error = xfs_trans_reserve(args.trans, args.total, | 303 | error = xfs_trans_reserve(args.trans, args.total, |
| 304 | XFS_ATTRSET_LOG_RES(mp, args.total), 0, | 304 | XFS_ATTRSETM_LOG_RES(mp) + |
| 305 | XFS_TRANS_PERM_LOG_RES, XFS_ATTRSET_LOG_COUNT))) { | 305 | XFS_ATTRSETRT_LOG_RES(mp) * args.total, |
| 306 | 0, XFS_TRANS_PERM_LOG_RES, | ||
| 307 | XFS_ATTRSET_LOG_COUNT); | ||
| 308 | if (error) { | ||
| 306 | xfs_trans_cancel(args.trans, 0); | 309 | xfs_trans_cancel(args.trans, 0); |
| 307 | return(error); | 310 | return(error); |
| 308 | } | 311 | } |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index cdb2d3348583..b44af9211bd9 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -147,7 +147,10 @@ xfs_bmap_local_to_extents( | |||
| 147 | xfs_fsblock_t *firstblock, /* first block allocated in xaction */ | 147 | xfs_fsblock_t *firstblock, /* first block allocated in xaction */ |
| 148 | xfs_extlen_t total, /* total blocks needed by transaction */ | 148 | xfs_extlen_t total, /* total blocks needed by transaction */ |
| 149 | int *logflagsp, /* inode logging flags */ | 149 | int *logflagsp, /* inode logging flags */ |
| 150 | int whichfork); /* data or attr fork */ | 150 | int whichfork, /* data or attr fork */ |
| 151 | void (*init_fn)(struct xfs_buf *bp, | ||
| 152 | struct xfs_inode *ip, | ||
| 153 | struct xfs_ifork *ifp)); | ||
| 151 | 154 | ||
| 152 | /* | 155 | /* |
| 153 | * Search the extents list for the inode, for the extent containing bno. | 156 | * Search the extents list for the inode, for the extent containing bno. |
| @@ -357,7 +360,42 @@ xfs_bmap_add_attrfork_extents( | |||
| 357 | } | 360 | } |
| 358 | 361 | ||
| 359 | /* | 362 | /* |
| 360 | * Called from xfs_bmap_add_attrfork to handle local format files. | 363 | * Block initialisation functions for local to extent format conversion. |
| 364 | * As these get more complex, they will be moved to the relevant files, | ||
| 365 | * but for now they are too simple to worry about. | ||
| 366 | */ | ||
| 367 | STATIC void | ||
| 368 | xfs_bmap_local_to_extents_init_fn( | ||
| 369 | struct xfs_buf *bp, | ||
| 370 | struct xfs_inode *ip, | ||
| 371 | struct xfs_ifork *ifp) | ||
| 372 | { | ||
| 373 | bp->b_ops = &xfs_bmbt_buf_ops; | ||
| 374 | memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); | ||
| 375 | } | ||
| 376 | |||
| 377 | STATIC void | ||
| 378 | xfs_symlink_local_to_remote( | ||
| 379 | struct xfs_buf *bp, | ||
| 380 | struct xfs_inode *ip, | ||
| 381 | struct xfs_ifork *ifp) | ||
| 382 | { | ||
| 383 | /* remote symlink blocks are not verifiable until CRCs come along */ | ||
| 384 | bp->b_ops = NULL; | ||
| 385 | memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); | ||
| 386 | } | ||
| 387 | |||
| 388 | /* | ||
| 389 | * Called from xfs_bmap_add_attrfork to handle local format files. Each | ||
| 390 | * different data fork content type needs a different callout to do the | ||
| 391 | * conversion. Some are basic and only require special block initialisation | ||
| 392 | * callouts for the data formating, others (directories) are so specialised they | ||
| 393 | * handle everything themselves. | ||
| 394 | * | ||
| 395 | * XXX (dgc): investigate whether directory conversion can use the generic | ||
| 396 | * formatting callout. It should be possible - it's just a very complex | ||
| 397 | * formatter. it would also require passing the transaction through to the init | ||
| 398 | * function. | ||
| 361 | */ | 399 | */ |
| 362 | STATIC int /* error */ | 400 | STATIC int /* error */ |
| 363 | xfs_bmap_add_attrfork_local( | 401 | xfs_bmap_add_attrfork_local( |
| @@ -368,25 +406,29 @@ xfs_bmap_add_attrfork_local( | |||
| 368 | int *flags) /* inode logging flags */ | 406 | int *flags) /* inode logging flags */ |
| 369 | { | 407 | { |
| 370 | xfs_da_args_t dargs; /* args for dir/attr code */ | 408 | xfs_da_args_t dargs; /* args for dir/attr code */ |
| 371 | int error; /* error return value */ | ||
| 372 | xfs_mount_t *mp; /* mount structure pointer */ | ||
| 373 | 409 | ||
| 374 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) | 410 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) |
| 375 | return 0; | 411 | return 0; |
| 412 | |||
| 376 | if (S_ISDIR(ip->i_d.di_mode)) { | 413 | if (S_ISDIR(ip->i_d.di_mode)) { |
| 377 | mp = ip->i_mount; | ||
| 378 | memset(&dargs, 0, sizeof(dargs)); | 414 | memset(&dargs, 0, sizeof(dargs)); |
| 379 | dargs.dp = ip; | 415 | dargs.dp = ip; |
| 380 | dargs.firstblock = firstblock; | 416 | dargs.firstblock = firstblock; |
| 381 | dargs.flist = flist; | 417 | dargs.flist = flist; |
| 382 | dargs.total = mp->m_dirblkfsbs; | 418 | dargs.total = ip->i_mount->m_dirblkfsbs; |
| 383 | dargs.whichfork = XFS_DATA_FORK; | 419 | dargs.whichfork = XFS_DATA_FORK; |
| 384 | dargs.trans = tp; | 420 | dargs.trans = tp; |
| 385 | error = xfs_dir2_sf_to_block(&dargs); | 421 | return xfs_dir2_sf_to_block(&dargs); |
| 386 | } else | 422 | } |
| 387 | error = xfs_bmap_local_to_extents(tp, ip, firstblock, 1, flags, | 423 | |
| 388 | XFS_DATA_FORK); | 424 | if (S_ISLNK(ip->i_d.di_mode)) |
| 389 | return error; | 425 | return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, |
| 426 | flags, XFS_DATA_FORK, | ||
| 427 | xfs_symlink_local_to_remote); | ||
| 428 | |||
| 429 | return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, flags, | ||
| 430 | XFS_DATA_FORK, | ||
| 431 | xfs_bmap_local_to_extents_init_fn); | ||
| 390 | } | 432 | } |
| 391 | 433 | ||
| 392 | /* | 434 | /* |
| @@ -3099,8 +3141,6 @@ xfs_bmap_extents_to_btree( | |||
| 3099 | args.fsbno = *firstblock; | 3141 | args.fsbno = *firstblock; |
| 3100 | } | 3142 | } |
| 3101 | args.minlen = args.maxlen = args.prod = 1; | 3143 | args.minlen = args.maxlen = args.prod = 1; |
| 3102 | args.total = args.minleft = args.alignment = args.mod = args.isfl = | ||
| 3103 | args.minalignslop = 0; | ||
| 3104 | args.wasdel = wasdel; | 3144 | args.wasdel = wasdel; |
| 3105 | *logflagsp = 0; | 3145 | *logflagsp = 0; |
| 3106 | if ((error = xfs_alloc_vextent(&args))) { | 3146 | if ((error = xfs_alloc_vextent(&args))) { |
| @@ -3221,7 +3261,10 @@ xfs_bmap_local_to_extents( | |||
| 3221 | xfs_fsblock_t *firstblock, /* first block allocated in xaction */ | 3261 | xfs_fsblock_t *firstblock, /* first block allocated in xaction */ |
| 3222 | xfs_extlen_t total, /* total blocks needed by transaction */ | 3262 | xfs_extlen_t total, /* total blocks needed by transaction */ |
| 3223 | int *logflagsp, /* inode logging flags */ | 3263 | int *logflagsp, /* inode logging flags */ |
| 3224 | int whichfork) /* data or attr fork */ | 3264 | int whichfork, |
| 3265 | void (*init_fn)(struct xfs_buf *bp, | ||
| 3266 | struct xfs_inode *ip, | ||
| 3267 | struct xfs_ifork *ifp)) | ||
| 3225 | { | 3268 | { |
| 3226 | int error; /* error return value */ | 3269 | int error; /* error return value */ |
| 3227 | int flags; /* logging flags returned */ | 3270 | int flags; /* logging flags returned */ |
| @@ -3241,12 +3284,12 @@ xfs_bmap_local_to_extents( | |||
| 3241 | xfs_buf_t *bp; /* buffer for extent block */ | 3284 | xfs_buf_t *bp; /* buffer for extent block */ |
| 3242 | xfs_bmbt_rec_host_t *ep;/* extent record pointer */ | 3285 | xfs_bmbt_rec_host_t *ep;/* extent record pointer */ |
| 3243 | 3286 | ||
| 3287 | ASSERT((ifp->if_flags & | ||
| 3288 | (XFS_IFINLINE|XFS_IFEXTENTS|XFS_IFEXTIREC)) == XFS_IFINLINE); | ||
| 3244 | memset(&args, 0, sizeof(args)); | 3289 | memset(&args, 0, sizeof(args)); |
| 3245 | args.tp = tp; | 3290 | args.tp = tp; |
| 3246 | args.mp = ip->i_mount; | 3291 | args.mp = ip->i_mount; |
| 3247 | args.firstblock = *firstblock; | 3292 | args.firstblock = *firstblock; |
| 3248 | ASSERT((ifp->if_flags & | ||
| 3249 | (XFS_IFINLINE|XFS_IFEXTENTS|XFS_IFEXTIREC)) == XFS_IFINLINE); | ||
| 3250 | /* | 3293 | /* |
| 3251 | * Allocate a block. We know we need only one, since the | 3294 | * Allocate a block. We know we need only one, since the |
| 3252 | * file currently fits in an inode. | 3295 | * file currently fits in an inode. |
| @@ -3259,20 +3302,21 @@ xfs_bmap_local_to_extents( | |||
| 3259 | args.type = XFS_ALLOCTYPE_NEAR_BNO; | 3302 | args.type = XFS_ALLOCTYPE_NEAR_BNO; |
| 3260 | } | 3303 | } |
| 3261 | args.total = total; | 3304 | args.total = total; |
| 3262 | args.mod = args.minleft = args.alignment = args.wasdel = | ||
| 3263 | args.isfl = args.minalignslop = 0; | ||
| 3264 | args.minlen = args.maxlen = args.prod = 1; | 3305 | args.minlen = args.maxlen = args.prod = 1; |
| 3265 | if ((error = xfs_alloc_vextent(&args))) | 3306 | error = xfs_alloc_vextent(&args); |
| 3307 | if (error) | ||
| 3266 | goto done; | 3308 | goto done; |
| 3267 | /* | 3309 | |
| 3268 | * Can't fail, the space was reserved. | 3310 | /* Can't fail, the space was reserved. */ |
| 3269 | */ | ||
| 3270 | ASSERT(args.fsbno != NULLFSBLOCK); | 3311 | ASSERT(args.fsbno != NULLFSBLOCK); |
| 3271 | ASSERT(args.len == 1); | 3312 | ASSERT(args.len == 1); |
| 3272 | *firstblock = args.fsbno; | 3313 | *firstblock = args.fsbno; |
| 3273 | bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); | 3314 | bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); |
| 3274 | bp->b_ops = &xfs_bmbt_buf_ops; | 3315 | |
| 3275 | memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); | 3316 | /* initialise the block and copy the data */ |
| 3317 | init_fn(bp, ip, ifp); | ||
| 3318 | |||
| 3319 | /* account for the change in fork size and log everything */ | ||
| 3276 | xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); | 3320 | xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); |
| 3277 | xfs_bmap_forkoff_reset(args.mp, ip, whichfork); | 3321 | xfs_bmap_forkoff_reset(args.mp, ip, whichfork); |
| 3278 | xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); | 3322 | xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); |
| @@ -4919,8 +4963,32 @@ xfs_bmapi_write( | |||
| 4919 | XFS_STATS_INC(xs_blk_mapw); | 4963 | XFS_STATS_INC(xs_blk_mapw); |
| 4920 | 4964 | ||
| 4921 | if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { | 4965 | if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { |
| 4966 | /* | ||
| 4967 | * XXX (dgc): This assumes we are only called for inodes that | ||
| 4968 | * contain content neutral data in local format. Anything that | ||
| 4969 | * contains caller-specific data in local format that needs | ||
| 4970 | * transformation to move to a block format needs to do the | ||
| 4971 | * conversion to extent format itself. | ||
| 4972 | * | ||
| 4973 | * Directory data forks and attribute forks handle this | ||
| 4974 | * themselves, but with the addition of metadata verifiers every | ||
| 4975 | * data fork in local format now contains caller specific data | ||
| 4976 | * and as such conversion through this function is likely to be | ||
| 4977 | * broken. | ||
| 4978 | * | ||
| 4979 | * The only likely user of this branch is for remote symlinks, | ||
| 4980 | * but we cannot overwrite the data fork contents of the symlink | ||
| 4981 | * (EEXIST occurs higher up the stack) and so it will never go | ||
| 4982 | * from local format to extent format here. Hence I don't think | ||
| 4983 | * this branch is ever executed intentionally and we should | ||
| 4984 | * consider removing it and asserting that xfs_bmapi_write() | ||
| 4985 | * cannot be called directly on local format forks. i.e. callers | ||
| 4986 | * are completely responsible for local to extent format | ||
| 4987 | * conversion, not xfs_bmapi_write(). | ||
| 4988 | */ | ||
| 4922 | error = xfs_bmap_local_to_extents(tp, ip, firstblock, total, | 4989 | error = xfs_bmap_local_to_extents(tp, ip, firstblock, total, |
| 4923 | &bma.logflags, whichfork); | 4990 | &bma.logflags, whichfork, |
| 4991 | xfs_bmap_local_to_extents_init_fn); | ||
| 4924 | if (error) | 4992 | if (error) |
| 4925 | goto error0; | 4993 | goto error0; |
| 4926 | } | 4994 | } |
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index fbbb9eb92e32..4e8f0df82d02 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
| @@ -951,8 +951,6 @@ xfs_buf_trylock( | |||
| 951 | locked = down_trylock(&bp->b_sema) == 0; | 951 | locked = down_trylock(&bp->b_sema) == 0; |
| 952 | if (locked) | 952 | if (locked) |
| 953 | XB_SET_OWNER(bp); | 953 | XB_SET_OWNER(bp); |
| 954 | else if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) | ||
| 955 | xfs_log_force(bp->b_target->bt_mount, 0); | ||
| 956 | 954 | ||
| 957 | trace_xfs_buf_trylock(bp, _RET_IP_); | 955 | trace_xfs_buf_trylock(bp, _RET_IP_); |
| 958 | return locked; | 956 | return locked; |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 3f9949fee391..cf263476d6b4 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
| @@ -37,109 +37,6 @@ static inline struct xfs_buf_log_item *BUF_ITEM(struct xfs_log_item *lip) | |||
| 37 | return container_of(lip, struct xfs_buf_log_item, bli_item); | 37 | return container_of(lip, struct xfs_buf_log_item, bli_item); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | |||
| 41 | #ifdef XFS_TRANS_DEBUG | ||
| 42 | /* | ||
| 43 | * This function uses an alternate strategy for tracking the bytes | ||
| 44 | * that the user requests to be logged. This can then be used | ||
| 45 | * in conjunction with the bli_orig array in the buf log item to | ||
| 46 | * catch bugs in our callers' code. | ||
| 47 | * | ||
| 48 | * We also double check the bits set in xfs_buf_item_log using a | ||
| 49 | * simple algorithm to check that every byte is accounted for. | ||
| 50 | */ | ||
| 51 | STATIC void | ||
| 52 | xfs_buf_item_log_debug( | ||
| 53 | xfs_buf_log_item_t *bip, | ||
| 54 | uint first, | ||
| 55 | uint last) | ||
| 56 | { | ||
| 57 | uint x; | ||
| 58 | uint byte; | ||
| 59 | uint nbytes; | ||
| 60 | uint chunk_num; | ||
| 61 | uint word_num; | ||
| 62 | uint bit_num; | ||
| 63 | uint bit_set; | ||
| 64 | uint *wordp; | ||
| 65 | |||
| 66 | ASSERT(bip->bli_logged != NULL); | ||
| 67 | byte = first; | ||
| 68 | nbytes = last - first + 1; | ||
| 69 | bfset(bip->bli_logged, first, nbytes); | ||
| 70 | for (x = 0; x < nbytes; x++) { | ||
| 71 | chunk_num = byte >> XFS_BLF_SHIFT; | ||
| 72 | word_num = chunk_num >> BIT_TO_WORD_SHIFT; | ||
| 73 | bit_num = chunk_num & (NBWORD - 1); | ||
| 74 | wordp = &(bip->__bli_format.blf_data_map[word_num]); | ||
| 75 | bit_set = *wordp & (1 << bit_num); | ||
| 76 | ASSERT(bit_set); | ||
| 77 | byte++; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | /* | ||
| 82 | * This function is called when we flush something into a buffer without | ||
| 83 | * logging it. This happens for things like inodes which are logged | ||
| 84 | * separately from the buffer. | ||
| 85 | */ | ||
| 86 | void | ||
| 87 | xfs_buf_item_flush_log_debug( | ||
| 88 | xfs_buf_t *bp, | ||
| 89 | uint first, | ||
| 90 | uint last) | ||
| 91 | { | ||
| 92 | xfs_buf_log_item_t *bip = bp->b_fspriv; | ||
| 93 | uint nbytes; | ||
| 94 | |||
| 95 | if (bip == NULL || (bip->bli_item.li_type != XFS_LI_BUF)) | ||
| 96 | return; | ||
| 97 | |||
| 98 | ASSERT(bip->bli_logged != NULL); | ||
| 99 | nbytes = last - first + 1; | ||
| 100 | bfset(bip->bli_logged, first, nbytes); | ||
| 101 | } | ||
| 102 | |||
| 103 | /* | ||
| 104 | * This function is called to verify that our callers have logged | ||
| 105 | * all the bytes that they changed. | ||
| 106 | * | ||
| 107 | * It does this by comparing the original copy of the buffer stored in | ||
| 108 | * the buf log item's bli_orig array to the current copy of the buffer | ||
| 109 | * and ensuring that all bytes which mismatch are set in the bli_logged | ||
| 110 | * array of the buf log item. | ||
| 111 | */ | ||
| 112 | STATIC void | ||
| 113 | xfs_buf_item_log_check( | ||
| 114 | xfs_buf_log_item_t *bip) | ||
| 115 | { | ||
| 116 | char *orig; | ||
| 117 | char *buffer; | ||
| 118 | int x; | ||
| 119 | xfs_buf_t *bp; | ||
| 120 | |||
| 121 | ASSERT(bip->bli_orig != NULL); | ||
| 122 | ASSERT(bip->bli_logged != NULL); | ||
| 123 | |||
| 124 | bp = bip->bli_buf; | ||
| 125 | ASSERT(bp->b_length > 0); | ||
| 126 | ASSERT(bp->b_addr != NULL); | ||
| 127 | orig = bip->bli_orig; | ||
| 128 | buffer = bp->b_addr; | ||
| 129 | for (x = 0; x < BBTOB(bp->b_length); x++) { | ||
| 130 | if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) { | ||
| 131 | xfs_emerg(bp->b_mount, | ||
| 132 | "%s: bip %x buffer %x orig %x index %d", | ||
| 133 | __func__, bip, bp, orig, x); | ||
| 134 | ASSERT(0); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | } | ||
| 138 | #else | ||
| 139 | #define xfs_buf_item_log_debug(x,y,z) | ||
| 140 | #define xfs_buf_item_log_check(x) | ||
| 141 | #endif | ||
| 142 | |||
| 143 | STATIC void xfs_buf_do_callbacks(struct xfs_buf *bp); | 40 | STATIC void xfs_buf_do_callbacks(struct xfs_buf *bp); |
| 144 | 41 | ||
| 145 | /* | 42 | /* |
| @@ -429,7 +326,6 @@ xfs_buf_item_format( | |||
| 429 | * Check to make sure everything is consistent. | 326 | * Check to make sure everything is consistent. |
| 430 | */ | 327 | */ |
| 431 | trace_xfs_buf_item_format(bip); | 328 | trace_xfs_buf_item_format(bip); |
| 432 | xfs_buf_item_log_check(bip); | ||
| 433 | } | 329 | } |
| 434 | 330 | ||
| 435 | /* | 331 | /* |
| @@ -573,8 +469,18 @@ xfs_buf_item_push( | |||
| 573 | 469 | ||
| 574 | if (xfs_buf_ispinned(bp)) | 470 | if (xfs_buf_ispinned(bp)) |
| 575 | return XFS_ITEM_PINNED; | 471 | return XFS_ITEM_PINNED; |
| 576 | if (!xfs_buf_trylock(bp)) | 472 | if (!xfs_buf_trylock(bp)) { |
| 473 | /* | ||
| 474 | * If we have just raced with a buffer being pinned and it has | ||
| 475 | * been marked stale, we could end up stalling until someone else | ||
| 476 | * issues a log force to unpin the stale buffer. Check for the | ||
| 477 | * race condition here so xfsaild recognizes the buffer is pinned | ||
| 478 | * and queues a log force to move it along. | ||
| 479 | */ | ||
| 480 | if (xfs_buf_ispinned(bp)) | ||
| 481 | return XFS_ITEM_PINNED; | ||
| 577 | return XFS_ITEM_LOCKED; | 482 | return XFS_ITEM_LOCKED; |
| 483 | } | ||
| 578 | 484 | ||
| 579 | ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); | 485 | ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); |
| 580 | 486 | ||
| @@ -923,8 +829,6 @@ xfs_buf_item_log_segment( | |||
| 923 | mask = (1 << end_bit) - 1; | 829 | mask = (1 << end_bit) - 1; |
| 924 | *wordp |= mask; | 830 | *wordp |= mask; |
| 925 | } | 831 | } |
| 926 | |||
| 927 | xfs_buf_item_log_debug(bip, first, last); | ||
| 928 | } | 832 | } |
| 929 | 833 | ||
| 930 | /* | 834 | /* |
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h index 16def435944a..ee36c88ecfde 100644 --- a/fs/xfs/xfs_buf_item.h +++ b/fs/xfs/xfs_buf_item.h | |||
| @@ -98,10 +98,6 @@ typedef struct xfs_buf_log_item { | |||
| 98 | unsigned int bli_flags; /* misc flags */ | 98 | unsigned int bli_flags; /* misc flags */ |
| 99 | unsigned int bli_recur; /* lock recursion count */ | 99 | unsigned int bli_recur; /* lock recursion count */ |
| 100 | atomic_t bli_refcount; /* cnt of tp refs */ | 100 | atomic_t bli_refcount; /* cnt of tp refs */ |
| 101 | #ifdef XFS_TRANS_DEBUG | ||
| 102 | char *bli_orig; /* original buffer copy */ | ||
| 103 | char *bli_logged; /* bytes logged (bitmap) */ | ||
| 104 | #endif | ||
| 105 | int bli_format_count; /* count of headers */ | 101 | int bli_format_count; /* count of headers */ |
| 106 | struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ | 102 | struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ |
| 107 | struct xfs_buf_log_format __bli_format; /* embedded in-log header */ | 103 | struct xfs_buf_log_format __bli_format; /* embedded in-log header */ |
| @@ -117,16 +113,6 @@ void xfs_buf_attach_iodone(struct xfs_buf *, | |||
| 117 | void xfs_buf_iodone_callbacks(struct xfs_buf *); | 113 | void xfs_buf_iodone_callbacks(struct xfs_buf *); |
| 118 | void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *); | 114 | void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *); |
| 119 | 115 | ||
| 120 | #ifdef XFS_TRANS_DEBUG | ||
| 121 | void | ||
| 122 | xfs_buf_item_flush_log_debug( | ||
| 123 | struct xfs_buf *bp, | ||
| 124 | uint first, | ||
| 125 | uint last); | ||
| 126 | #else | ||
| 127 | #define xfs_buf_item_flush_log_debug(bp, first, last) | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #endif /* __KERNEL__ */ | 116 | #endif /* __KERNEL__ */ |
| 131 | 117 | ||
| 132 | #endif /* __XFS_BUF_ITEM_H__ */ | 118 | #endif /* __XFS_BUF_ITEM_H__ */ |
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 9e1bf5294c91..8025eb23ad72 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
| @@ -612,15 +612,9 @@ xfs_qm_dqread( | |||
| 612 | if (flags & XFS_QMOPT_DQALLOC) { | 612 | if (flags & XFS_QMOPT_DQALLOC) { |
| 613 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_DQALLOC); | 613 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_DQALLOC); |
| 614 | error = xfs_trans_reserve(tp, XFS_QM_DQALLOC_SPACE_RES(mp), | 614 | error = xfs_trans_reserve(tp, XFS_QM_DQALLOC_SPACE_RES(mp), |
| 615 | XFS_WRITE_LOG_RES(mp) + | 615 | XFS_QM_DQALLOC_LOG_RES(mp), 0, |
| 616 | /* | 616 | XFS_TRANS_PERM_LOG_RES, |
| 617 | * Round the chunklen up to the next multiple | 617 | XFS_WRITE_LOG_COUNT); |
| 618 | * of 128 (buf log item chunk size)). | ||
| 619 | */ | ||
| 620 | BBTOB(mp->m_quotainfo->qi_dqchunklen) - 1 + 128, | ||
| 621 | 0, | ||
| 622 | XFS_TRANS_PERM_LOG_RES, | ||
| 623 | XFS_WRITE_LOG_COUNT); | ||
| 624 | if (error) | 618 | if (error) |
| 625 | goto error1; | 619 | goto error1; |
| 626 | cancelflags = XFS_TRANS_RELEASE_LOG_RES; | 620 | cancelflags = XFS_TRANS_RELEASE_LOG_RES; |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 94eaeedc5498..2866b8c78b7a 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
| @@ -709,8 +709,8 @@ xfs_fs_log_dummy( | |||
| 709 | int error; | 709 | int error; |
| 710 | 710 | ||
| 711 | tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1, KM_SLEEP); | 711 | tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1, KM_SLEEP); |
| 712 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | 712 | error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0, |
| 713 | XFS_DEFAULT_LOG_COUNT); | 713 | XFS_DEFAULT_LOG_COUNT); |
| 714 | if (error) { | 714 | if (error) { |
| 715 | xfs_trans_cancel(tp, 0); | 715 | xfs_trans_cancel(tp, 0); |
| 716 | return error; | 716 | return error; |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index a815412eab80..515bf71ce01c 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
| @@ -279,8 +279,6 @@ xfs_ialloc_ag_alloc( | |||
| 279 | (args.agbno < be32_to_cpu(agi->agi_length)))) { | 279 | (args.agbno < be32_to_cpu(agi->agi_length)))) { |
| 280 | args.fsbno = XFS_AGB_TO_FSB(args.mp, agno, args.agbno); | 280 | args.fsbno = XFS_AGB_TO_FSB(args.mp, agno, args.agbno); |
| 281 | args.type = XFS_ALLOCTYPE_THIS_BNO; | 281 | args.type = XFS_ALLOCTYPE_THIS_BNO; |
| 282 | args.mod = args.total = args.wasdel = args.isfl = | ||
| 283 | args.userdata = args.minalignslop = 0; | ||
| 284 | args.prod = 1; | 282 | args.prod = 1; |
| 285 | 283 | ||
| 286 | /* | 284 | /* |
| @@ -333,8 +331,6 @@ xfs_ialloc_ag_alloc( | |||
| 333 | * Allocate a fixed-size extent of inodes. | 331 | * Allocate a fixed-size extent of inodes. |
| 334 | */ | 332 | */ |
| 335 | args.type = XFS_ALLOCTYPE_NEAR_BNO; | 333 | args.type = XFS_ALLOCTYPE_NEAR_BNO; |
| 336 | args.mod = args.total = args.wasdel = args.isfl = | ||
| 337 | args.userdata = args.minalignslop = 0; | ||
| 338 | args.prod = 1; | 334 | args.prod = 1; |
| 339 | /* | 335 | /* |
| 340 | * Allow space for the inode btree to split. | 336 | * Allow space for the inode btree to split. |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 66282dcb821b..4f201656d2d9 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -2379,9 +2379,6 @@ xfs_iflush_fork( | |||
| 2379 | char *cp; | 2379 | char *cp; |
| 2380 | xfs_ifork_t *ifp; | 2380 | xfs_ifork_t *ifp; |
| 2381 | xfs_mount_t *mp; | 2381 | xfs_mount_t *mp; |
| 2382 | #ifdef XFS_TRANS_DEBUG | ||
| 2383 | int first; | ||
| 2384 | #endif | ||
| 2385 | static const short brootflag[2] = | 2382 | static const short brootflag[2] = |
| 2386 | { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT }; | 2383 | { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT }; |
| 2387 | static const short dataflag[2] = | 2384 | static const short dataflag[2] = |
| @@ -2724,9 +2721,6 @@ xfs_iflush_int( | |||
| 2724 | xfs_inode_log_item_t *iip; | 2721 | xfs_inode_log_item_t *iip; |
| 2725 | xfs_dinode_t *dip; | 2722 | xfs_dinode_t *dip; |
| 2726 | xfs_mount_t *mp; | 2723 | xfs_mount_t *mp; |
| 2727 | #ifdef XFS_TRANS_DEBUG | ||
| 2728 | int first; | ||
| 2729 | #endif | ||
| 2730 | 2724 | ||
| 2731 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2725 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
| 2732 | ASSERT(xfs_isiflocked(ip)); | 2726 | ASSERT(xfs_isiflocked(ip)); |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 22baf6ea4fac..237e7f6f2ab3 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
| @@ -419,6 +419,7 @@ static inline void xfs_iflock(struct xfs_inode *ip) | |||
| 419 | static inline void xfs_ifunlock(struct xfs_inode *ip) | 419 | static inline void xfs_ifunlock(struct xfs_inode *ip) |
| 420 | { | 420 | { |
| 421 | xfs_iflags_clear(ip, XFS_IFLOCK); | 421 | xfs_iflags_clear(ip, XFS_IFLOCK); |
| 422 | smp_mb(); | ||
| 422 | wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT); | 423 | wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT); |
| 423 | } | 424 | } |
| 424 | 425 | ||
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index d041d47d9d86..f034bd1652f0 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
| @@ -269,17 +269,6 @@ xfs_inode_item_format( | |||
| 269 | } else { | 269 | } else { |
| 270 | ASSERT(!(iip->ili_fields & | 270 | ASSERT(!(iip->ili_fields & |
| 271 | XFS_ILOG_DBROOT)); | 271 | XFS_ILOG_DBROOT)); |
| 272 | #ifdef XFS_TRANS_DEBUG | ||
| 273 | if (iip->ili_root_size > 0) { | ||
| 274 | ASSERT(iip->ili_root_size == | ||
| 275 | ip->i_df.if_broot_bytes); | ||
| 276 | ASSERT(memcmp(iip->ili_orig_root, | ||
| 277 | ip->i_df.if_broot, | ||
| 278 | iip->ili_root_size) == 0); | ||
| 279 | } else { | ||
| 280 | ASSERT(ip->i_df.if_broot_bytes == 0); | ||
| 281 | } | ||
| 282 | #endif | ||
| 283 | iip->ili_fields &= ~XFS_ILOG_DBROOT; | 272 | iip->ili_fields &= ~XFS_ILOG_DBROOT; |
| 284 | } | 273 | } |
| 285 | break; | 274 | break; |
| @@ -678,11 +667,6 @@ void | |||
| 678 | xfs_inode_item_destroy( | 667 | xfs_inode_item_destroy( |
| 679 | xfs_inode_t *ip) | 668 | xfs_inode_t *ip) |
| 680 | { | 669 | { |
| 681 | #ifdef XFS_TRANS_DEBUG | ||
| 682 | if (ip->i_itemp->ili_root_size != 0) { | ||
| 683 | kmem_free(ip->i_itemp->ili_orig_root); | ||
| 684 | } | ||
| 685 | #endif | ||
| 686 | kmem_zone_free(xfs_ili_zone, ip->i_itemp); | 670 | kmem_zone_free(xfs_ili_zone, ip->i_itemp); |
| 687 | } | 671 | } |
| 688 | 672 | ||
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h index 376d4d0b2635..779812fb3d80 100644 --- a/fs/xfs/xfs_inode_item.h +++ b/fs/xfs/xfs_inode_item.h | |||
| @@ -148,10 +148,6 @@ typedef struct xfs_inode_log_item { | |||
| 148 | data exts */ | 148 | data exts */ |
| 149 | struct xfs_bmbt_rec *ili_aextents_buf; /* array of logged | 149 | struct xfs_bmbt_rec *ili_aextents_buf; /* array of logged |
| 150 | attr exts */ | 150 | attr exts */ |
| 151 | #ifdef XFS_TRANS_DEBUG | ||
| 152 | int ili_root_size; | ||
| 153 | char *ili_orig_root; | ||
| 154 | #endif | ||
| 155 | xfs_inode_log_format_t ili_format; /* logged structure */ | 151 | xfs_inode_log_format_t ili_format; /* logged structure */ |
| 156 | } xfs_inode_log_item_t; | 152 | } xfs_inode_log_item_t; |
| 157 | 153 | ||
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 364818eef40e..912d83d8860a 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
| @@ -311,6 +311,62 @@ xfs_iomap_eof_want_preallocate( | |||
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | /* | 313 | /* |
| 314 | * Determine the initial size of the preallocation. We are beyond the current | ||
| 315 | * EOF here, but we need to take into account whether this is a sparse write or | ||
| 316 | * an extending write when determining the preallocation size. Hence we need to | ||
| 317 | * look up the extent that ends at the current write offset and use the result | ||
| 318 | * to determine the preallocation size. | ||
| 319 | * | ||
| 320 | * If the extent is a hole, then preallocation is essentially disabled. | ||
| 321 | * Otherwise we take the size of the preceeding data extent as the basis for the | ||
| 322 | * preallocation size. If the size of the extent is greater than half the | ||
| 323 | * maximum extent length, then use the current offset as the basis. This ensures | ||
| 324 | * that for large files the preallocation size always extends to MAXEXTLEN | ||
| 325 | * rather than falling short due to things like stripe unit/width alignment of | ||
| 326 | * real extents. | ||
| 327 | */ | ||
| 328 | STATIC int | ||
| 329 | xfs_iomap_eof_prealloc_initial_size( | ||
| 330 | struct xfs_mount *mp, | ||
| 331 | struct xfs_inode *ip, | ||
| 332 | xfs_off_t offset, | ||
| 333 | xfs_bmbt_irec_t *imap, | ||
| 334 | int nimaps) | ||
| 335 | { | ||
| 336 | xfs_fileoff_t start_fsb; | ||
| 337 | int imaps = 1; | ||
| 338 | int error; | ||
| 339 | |||
| 340 | ASSERT(nimaps >= imaps); | ||
| 341 | |||
| 342 | /* if we are using a specific prealloc size, return now */ | ||
| 343 | if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) | ||
| 344 | return 0; | ||
| 345 | |||
| 346 | /* | ||
| 347 | * As we write multiple pages, the offset will always align to the | ||
| 348 | * start of a page and hence point to a hole at EOF. i.e. if the size is | ||
| 349 | * 4096 bytes, we only have one block at FSB 0, but XFS_B_TO_FSB(4096) | ||
| 350 | * will return FSB 1. Hence if there are blocks in the file, we want to | ||
| 351 | * point to the block prior to the EOF block and not the hole that maps | ||
| 352 | * directly at @offset. | ||
| 353 | */ | ||
| 354 | start_fsb = XFS_B_TO_FSB(mp, offset); | ||
| 355 | if (start_fsb) | ||
| 356 | start_fsb--; | ||
| 357 | error = xfs_bmapi_read(ip, start_fsb, 1, imap, &imaps, XFS_BMAPI_ENTIRE); | ||
| 358 | if (error) | ||
| 359 | return 0; | ||
| 360 | |||
| 361 | ASSERT(imaps == 1); | ||
| 362 | if (imap[0].br_startblock == HOLESTARTBLOCK) | ||
| 363 | return 0; | ||
| 364 | if (imap[0].br_blockcount <= (MAXEXTLEN >> 1)) | ||
| 365 | return imap[0].br_blockcount; | ||
| 366 | return XFS_B_TO_FSB(mp, offset); | ||
| 367 | } | ||
| 368 | |||
| 369 | /* | ||
| 314 | * If we don't have a user specified preallocation size, dynamically increase | 370 | * If we don't have a user specified preallocation size, dynamically increase |
| 315 | * the preallocation size as the size of the file grows. Cap the maximum size | 371 | * the preallocation size as the size of the file grows. Cap the maximum size |
| 316 | * at a single extent or less if the filesystem is near full. The closer the | 372 | * at a single extent or less if the filesystem is near full. The closer the |
| @@ -319,20 +375,19 @@ xfs_iomap_eof_want_preallocate( | |||
| 319 | STATIC xfs_fsblock_t | 375 | STATIC xfs_fsblock_t |
| 320 | xfs_iomap_prealloc_size( | 376 | xfs_iomap_prealloc_size( |
| 321 | struct xfs_mount *mp, | 377 | struct xfs_mount *mp, |
| 322 | struct xfs_inode *ip) | 378 | struct xfs_inode *ip, |
| 379 | xfs_off_t offset, | ||
| 380 | struct xfs_bmbt_irec *imap, | ||
| 381 | int nimaps) | ||
| 323 | { | 382 | { |
| 324 | xfs_fsblock_t alloc_blocks = 0; | 383 | xfs_fsblock_t alloc_blocks = 0; |
| 325 | 384 | ||
| 326 | if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) { | 385 | alloc_blocks = xfs_iomap_eof_prealloc_initial_size(mp, ip, offset, |
| 386 | imap, nimaps); | ||
| 387 | if (alloc_blocks > 0) { | ||
| 327 | int shift = 0; | 388 | int shift = 0; |
| 328 | int64_t freesp; | 389 | int64_t freesp; |
| 329 | 390 | ||
| 330 | /* | ||
| 331 | * rounddown_pow_of_two() returns an undefined result | ||
| 332 | * if we pass in alloc_blocks = 0. Hence the "+ 1" to | ||
| 333 | * ensure we always pass in a non-zero value. | ||
| 334 | */ | ||
| 335 | alloc_blocks = XFS_B_TO_FSB(mp, XFS_ISIZE(ip)) + 1; | ||
| 336 | alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN, | 391 | alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN, |
| 337 | rounddown_pow_of_two(alloc_blocks)); | 392 | rounddown_pow_of_two(alloc_blocks)); |
| 338 | 393 | ||
| @@ -399,7 +454,6 @@ xfs_iomap_write_delay( | |||
| 399 | extsz = xfs_get_extsz_hint(ip); | 454 | extsz = xfs_get_extsz_hint(ip); |
| 400 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 455 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
| 401 | 456 | ||
| 402 | |||
| 403 | error = xfs_iomap_eof_want_preallocate(mp, ip, offset, count, | 457 | error = xfs_iomap_eof_want_preallocate(mp, ip, offset, count, |
| 404 | imap, XFS_WRITE_IMAPS, &prealloc); | 458 | imap, XFS_WRITE_IMAPS, &prealloc); |
| 405 | if (error) | 459 | if (error) |
| @@ -407,7 +461,10 @@ xfs_iomap_write_delay( | |||
| 407 | 461 | ||
| 408 | retry: | 462 | retry: |
| 409 | if (prealloc) { | 463 | if (prealloc) { |
| 410 | xfs_fsblock_t alloc_blocks = xfs_iomap_prealloc_size(mp, ip); | 464 | xfs_fsblock_t alloc_blocks; |
| 465 | |||
| 466 | alloc_blocks = xfs_iomap_prealloc_size(mp, ip, offset, imap, | ||
| 467 | XFS_WRITE_IMAPS); | ||
| 411 | 468 | ||
| 412 | aligned_offset = XFS_WRITEIO_ALIGN(mp, (offset + count - 1)); | 469 | aligned_offset = XFS_WRITEIO_ALIGN(mp, (offset + count - 1)); |
| 413 | ioalign = XFS_B_TO_FSBT(mp, aligned_offset); | 470 | ioalign = XFS_B_TO_FSBT(mp, aligned_offset); |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 46bd9d52ab51..eec226f78a40 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
| @@ -120,7 +120,7 @@ xlog_verify_iclog( | |||
| 120 | struct xlog *log, | 120 | struct xlog *log, |
| 121 | struct xlog_in_core *iclog, | 121 | struct xlog_in_core *iclog, |
| 122 | int count, | 122 | int count, |
| 123 | boolean_t syncing); | 123 | bool syncing); |
| 124 | STATIC void | 124 | STATIC void |
| 125 | xlog_verify_tail_lsn( | 125 | xlog_verify_tail_lsn( |
| 126 | struct xlog *log, | 126 | struct xlog *log, |
| @@ -1737,7 +1737,7 @@ xlog_sync( | |||
| 1737 | ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); | 1737 | ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); |
| 1738 | ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize); | 1738 | ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize); |
| 1739 | 1739 | ||
| 1740 | xlog_verify_iclog(log, iclog, count, B_TRUE); | 1740 | xlog_verify_iclog(log, iclog, count, true); |
| 1741 | 1741 | ||
| 1742 | /* account for log which doesn't start at block #0 */ | 1742 | /* account for log which doesn't start at block #0 */ |
| 1743 | XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); | 1743 | XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); |
| @@ -3611,7 +3611,7 @@ xlog_verify_iclog( | |||
| 3611 | struct xlog *log, | 3611 | struct xlog *log, |
| 3612 | struct xlog_in_core *iclog, | 3612 | struct xlog_in_core *iclog, |
| 3613 | int count, | 3613 | int count, |
| 3614 | boolean_t syncing) | 3614 | bool syncing) |
| 3615 | { | 3615 | { |
| 3616 | xlog_op_header_t *ophead; | 3616 | xlog_op_header_t *ophead; |
| 3617 | xlog_in_core_t *icptr; | 3617 | xlog_in_core_t *icptr; |
| @@ -3659,7 +3659,7 @@ xlog_verify_iclog( | |||
| 3659 | /* clientid is only 1 byte */ | 3659 | /* clientid is only 1 byte */ |
| 3660 | field_offset = (__psint_t) | 3660 | field_offset = (__psint_t) |
| 3661 | ((xfs_caddr_t)&(ophead->oh_clientid) - base_ptr); | 3661 | ((xfs_caddr_t)&(ophead->oh_clientid) - base_ptr); |
| 3662 | if (syncing == B_FALSE || (field_offset & 0x1ff)) { | 3662 | if (!syncing || (field_offset & 0x1ff)) { |
| 3663 | clientid = ophead->oh_clientid; | 3663 | clientid = ophead->oh_clientid; |
| 3664 | } else { | 3664 | } else { |
| 3665 | idx = BTOBBT((xfs_caddr_t)&(ophead->oh_clientid) - iclog->ic_datap); | 3665 | idx = BTOBBT((xfs_caddr_t)&(ophead->oh_clientid) - iclog->ic_datap); |
| @@ -3682,7 +3682,7 @@ xlog_verify_iclog( | |||
| 3682 | /* check length */ | 3682 | /* check length */ |
| 3683 | field_offset = (__psint_t) | 3683 | field_offset = (__psint_t) |
| 3684 | ((xfs_caddr_t)&(ophead->oh_len) - base_ptr); | 3684 | ((xfs_caddr_t)&(ophead->oh_len) - base_ptr); |
| 3685 | if (syncing == B_FALSE || (field_offset & 0x1ff)) { | 3685 | if (!syncing || (field_offset & 0x1ff)) { |
| 3686 | op_len = be32_to_cpu(ophead->oh_len); | 3686 | op_len = be32_to_cpu(ophead->oh_len); |
| 3687 | } else { | 3687 | } else { |
| 3688 | idx = BTOBBT((__psint_t)&ophead->oh_len - | 3688 | idx = BTOBBT((__psint_t)&ophead->oh_len - |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 7d6df7c00c36..3806088a8f77 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
| @@ -1109,8 +1109,8 @@ xfs_mount_reset_sbqflags( | |||
| 1109 | return 0; | 1109 | return 0; |
| 1110 | 1110 | ||
| 1111 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | 1111 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); |
| 1112 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | 1112 | error = xfs_trans_reserve(tp, 0, XFS_QM_SBCHANGE_LOG_RES(mp), |
| 1113 | XFS_DEFAULT_LOG_COUNT); | 1113 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 1114 | if (error) { | 1114 | if (error) { |
| 1115 | xfs_trans_cancel(tp, 0); | 1115 | xfs_trans_cancel(tp, 0); |
| 1116 | xfs_alert(mp, "%s: Superblock update failed!", __func__); | 1116 | xfs_alert(mp, "%s: Superblock update failed!", __func__); |
| @@ -1583,8 +1583,8 @@ xfs_log_sbcount(xfs_mount_t *mp) | |||
| 1583 | return 0; | 1583 | return 0; |
| 1584 | 1584 | ||
| 1585 | tp = _xfs_trans_alloc(mp, XFS_TRANS_SB_COUNT, KM_SLEEP); | 1585 | tp = _xfs_trans_alloc(mp, XFS_TRANS_SB_COUNT, KM_SLEEP); |
| 1586 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | 1586 | error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0, |
| 1587 | XFS_DEFAULT_LOG_COUNT); | 1587 | XFS_DEFAULT_LOG_COUNT); |
| 1588 | if (error) { | 1588 | if (error) { |
| 1589 | xfs_trans_cancel(tp, 0); | 1589 | xfs_trans_cancel(tp, 0); |
| 1590 | return error; | 1590 | return error; |
| @@ -1945,8 +1945,8 @@ xfs_mount_log_sb( | |||
| 1945 | XFS_SB_VERSIONNUM)); | 1945 | XFS_SB_VERSIONNUM)); |
| 1946 | 1946 | ||
| 1947 | tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT); | 1947 | tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT); |
| 1948 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | 1948 | error = xfs_trans_reserve(tp, 0, XFS_SB_LOG_RES(mp), 0, 0, |
| 1949 | XFS_DEFAULT_LOG_COUNT); | 1949 | XFS_DEFAULT_LOG_COUNT); |
| 1950 | if (error) { | 1950 | if (error) { |
| 1951 | xfs_trans_cancel(tp, 0); | 1951 | xfs_trans_cancel(tp, 0); |
| 1952 | return error; | 1952 | return error; |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index bab8314507e4..bc907061d392 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
| @@ -34,12 +34,19 @@ typedef struct xfs_trans_reservations { | |||
| 34 | uint tr_addafork; /* cvt inode to attributed trans */ | 34 | uint tr_addafork; /* cvt inode to attributed trans */ |
| 35 | uint tr_writeid; /* write setuid/setgid file */ | 35 | uint tr_writeid; /* write setuid/setgid file */ |
| 36 | uint tr_attrinval; /* attr fork buffer invalidation */ | 36 | uint tr_attrinval; /* attr fork buffer invalidation */ |
| 37 | uint tr_attrset; /* set/create an attribute */ | 37 | uint tr_attrsetm; /* set/create an attribute at mount time */ |
| 38 | uint tr_attrsetrt; /* set/create an attribute at runtime */ | ||
| 38 | uint tr_attrrm; /* remove an attribute */ | 39 | uint tr_attrrm; /* remove an attribute */ |
| 39 | uint tr_clearagi; /* clear bad agi unlinked ino bucket */ | 40 | uint tr_clearagi; /* clear bad agi unlinked ino bucket */ |
| 40 | uint tr_growrtalloc; /* grow realtime allocations */ | 41 | uint tr_growrtalloc; /* grow realtime allocations */ |
| 41 | uint tr_growrtzero; /* grow realtime zeroing */ | 42 | uint tr_growrtzero; /* grow realtime zeroing */ |
| 42 | uint tr_growrtfree; /* grow realtime freeing */ | 43 | uint tr_growrtfree; /* grow realtime freeing */ |
| 44 | uint tr_qm_sbchange; /* change quota flags */ | ||
| 45 | uint tr_qm_setqlim; /* adjust quota limits */ | ||
| 46 | uint tr_qm_dqalloc; /* allocate quota on disk */ | ||
| 47 | uint tr_qm_quotaoff; /* turn quota off */ | ||
| 48 | uint tr_qm_equotaoff;/* end of turn quota off */ | ||
| 49 | uint tr_sb; /* modify superblock */ | ||
| 43 | } xfs_trans_reservations_t; | 50 | } xfs_trans_reservations_t; |
| 44 | 51 | ||
| 45 | #ifndef __KERNEL__ | 52 | #ifndef __KERNEL__ |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 60eff4763156..e5b5cf973781 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
| @@ -1584,10 +1584,9 @@ xfs_qm_write_sb_changes( | |||
| 1584 | int error; | 1584 | int error; |
| 1585 | 1585 | ||
| 1586 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | 1586 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); |
| 1587 | if ((error = xfs_trans_reserve(tp, 0, | 1587 | error = xfs_trans_reserve(tp, 0, XFS_QM_SBCHANGE_LOG_RES(mp), |
| 1588 | mp->m_sb.sb_sectsize + 128, 0, | 1588 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 1589 | 0, | 1589 | if (error) { |
| 1590 | XFS_DEFAULT_LOG_COUNT))) { | ||
| 1591 | xfs_trans_cancel(tp, 0); | 1590 | xfs_trans_cancel(tp, 0); |
| 1592 | return error; | 1591 | return error; |
| 1593 | } | 1592 | } |
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c index 6b39115bf145..2d02eac1c9a8 100644 --- a/fs/xfs/xfs_qm_bhv.c +++ b/fs/xfs/xfs_qm_bhv.c | |||
| @@ -146,7 +146,7 @@ xfs_qm_newmount( | |||
| 146 | * inode goes inactive and wants to free blocks, | 146 | * inode goes inactive and wants to free blocks, |
| 147 | * or via xfs_log_mount_finish. | 147 | * or via xfs_log_mount_finish. |
| 148 | */ | 148 | */ |
| 149 | *needquotamount = B_TRUE; | 149 | *needquotamount = true; |
| 150 | *quotaflags = mp->m_qflags; | 150 | *quotaflags = mp->m_qflags; |
| 151 | mp->m_qflags = 0; | 151 | mp->m_qflags = 0; |
| 152 | } | 152 | } |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 8a59f8546552..cf9a34051e07 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
| @@ -408,10 +408,10 @@ xfs_qm_scall_getqstat( | |||
| 408 | { | 408 | { |
| 409 | struct xfs_quotainfo *q = mp->m_quotainfo; | 409 | struct xfs_quotainfo *q = mp->m_quotainfo; |
| 410 | struct xfs_inode *uip, *gip; | 410 | struct xfs_inode *uip, *gip; |
| 411 | boolean_t tempuqip, tempgqip; | 411 | bool tempuqip, tempgqip; |
| 412 | 412 | ||
| 413 | uip = gip = NULL; | 413 | uip = gip = NULL; |
| 414 | tempuqip = tempgqip = B_FALSE; | 414 | tempuqip = tempgqip = false; |
| 415 | memset(out, 0, sizeof(fs_quota_stat_t)); | 415 | memset(out, 0, sizeof(fs_quota_stat_t)); |
| 416 | 416 | ||
| 417 | out->qs_version = FS_QSTAT_VERSION; | 417 | out->qs_version = FS_QSTAT_VERSION; |
| @@ -434,12 +434,12 @@ xfs_qm_scall_getqstat( | |||
| 434 | if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) { | 434 | if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) { |
| 435 | if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, | 435 | if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, |
| 436 | 0, 0, &uip) == 0) | 436 | 0, 0, &uip) == 0) |
| 437 | tempuqip = B_TRUE; | 437 | tempuqip = true; |
| 438 | } | 438 | } |
| 439 | if (!gip && mp->m_sb.sb_gquotino != NULLFSINO) { | 439 | if (!gip && mp->m_sb.sb_gquotino != NULLFSINO) { |
| 440 | if (xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, | 440 | if (xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, |
| 441 | 0, 0, &gip) == 0) | 441 | 0, 0, &gip) == 0) |
| 442 | tempgqip = B_TRUE; | 442 | tempgqip = true; |
| 443 | } | 443 | } |
| 444 | if (uip) { | 444 | if (uip) { |
| 445 | out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; | 445 | out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; |
| @@ -490,8 +490,9 @@ xfs_qm_scall_setqlim( | |||
| 490 | return 0; | 490 | return 0; |
| 491 | 491 | ||
| 492 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); | 492 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); |
| 493 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_disk_dquot_t) + 128, | 493 | error = xfs_trans_reserve(tp, 0, XFS_QM_SETQLIM_LOG_RES(mp), |
| 494 | 0, 0, XFS_DEFAULT_LOG_COUNT))) { | 494 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 495 | if (error) { | ||
| 495 | xfs_trans_cancel(tp, 0); | 496 | xfs_trans_cancel(tp, 0); |
| 496 | return (error); | 497 | return (error); |
| 497 | } | 498 | } |
| @@ -638,8 +639,9 @@ xfs_qm_log_quotaoff_end( | |||
| 638 | 639 | ||
| 639 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); | 640 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); |
| 640 | 641 | ||
| 641 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_qoff_logitem_t) * 2, | 642 | error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_END_LOG_RES(mp), |
| 642 | 0, 0, XFS_DEFAULT_LOG_COUNT))) { | 643 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 644 | if (error) { | ||
| 643 | xfs_trans_cancel(tp, 0); | 645 | xfs_trans_cancel(tp, 0); |
| 644 | return (error); | 646 | return (error); |
| 645 | } | 647 | } |
| @@ -671,14 +673,10 @@ xfs_qm_log_quotaoff( | |||
| 671 | uint oldsbqflag=0; | 673 | uint oldsbqflag=0; |
| 672 | 674 | ||
| 673 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF); | 675 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF); |
| 674 | if ((error = xfs_trans_reserve(tp, 0, | 676 | error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_LOG_RES(mp), |
| 675 | sizeof(xfs_qoff_logitem_t) * 2 + | 677 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 676 | mp->m_sb.sb_sectsize + 128, | 678 | if (error) |
| 677 | 0, | ||
| 678 | 0, | ||
| 679 | XFS_DEFAULT_LOG_COUNT))) { | ||
| 680 | goto error0; | 679 | goto error0; |
| 681 | } | ||
| 682 | 680 | ||
| 683 | qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT); | 681 | qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT); |
| 684 | xfs_trans_log_quotaoff_item(tp, qoffi); | 682 | xfs_trans_log_quotaoff_item(tp, qoffi); |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index ab8839b26272..c407121873b4 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
| @@ -139,9 +139,9 @@ static const match_table_t tokens = { | |||
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | STATIC unsigned long | 141 | STATIC unsigned long |
| 142 | suffix_strtoul(char *s, char **endp, unsigned int base) | 142 | suffix_kstrtoint(char *s, unsigned int base, int *res) |
| 143 | { | 143 | { |
| 144 | int last, shift_left_factor = 0; | 144 | int last, shift_left_factor = 0, _res; |
| 145 | char *value = s; | 145 | char *value = s; |
| 146 | 146 | ||
| 147 | last = strlen(value) - 1; | 147 | last = strlen(value) - 1; |
| @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base) | |||
| 158 | value[last] = '\0'; | 158 | value[last] = '\0'; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | return simple_strtoul((const char *)s, endp, base) << shift_left_factor; | 161 | if (kstrtoint(s, base, &_res)) |
| 162 | return -EINVAL; | ||
| 163 | *res = _res << shift_left_factor; | ||
| 164 | return 0; | ||
| 162 | } | 165 | } |
| 163 | 166 | ||
| 164 | /* | 167 | /* |
| @@ -174,7 +177,7 @@ xfs_parseargs( | |||
| 174 | char *options) | 177 | char *options) |
| 175 | { | 178 | { |
| 176 | struct super_block *sb = mp->m_super; | 179 | struct super_block *sb = mp->m_super; |
| 177 | char *this_char, *value, *eov; | 180 | char *this_char, *value; |
| 178 | int dsunit = 0; | 181 | int dsunit = 0; |
| 179 | int dswidth = 0; | 182 | int dswidth = 0; |
| 180 | int iosize = 0; | 183 | int iosize = 0; |
| @@ -230,14 +233,16 @@ xfs_parseargs( | |||
| 230 | this_char); | 233 | this_char); |
| 231 | return EINVAL; | 234 | return EINVAL; |
| 232 | } | 235 | } |
| 233 | mp->m_logbufs = simple_strtoul(value, &eov, 10); | 236 | if (kstrtoint(value, 10, &mp->m_logbufs)) |
| 237 | return EINVAL; | ||
| 234 | } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { | 238 | } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { |
| 235 | if (!value || !*value) { | 239 | if (!value || !*value) { |
| 236 | xfs_warn(mp, "%s option requires an argument", | 240 | xfs_warn(mp, "%s option requires an argument", |
| 237 | this_char); | 241 | this_char); |
| 238 | return EINVAL; | 242 | return EINVAL; |
| 239 | } | 243 | } |
| 240 | mp->m_logbsize = suffix_strtoul(value, &eov, 10); | 244 | if (suffix_kstrtoint(value, 10, &mp->m_logbsize)) |
| 245 | return EINVAL; | ||
| 241 | } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { | 246 | } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { |
| 242 | if (!value || !*value) { | 247 | if (!value || !*value) { |
| 243 | xfs_warn(mp, "%s option requires an argument", | 248 | xfs_warn(mp, "%s option requires an argument", |
| @@ -266,7 +271,8 @@ xfs_parseargs( | |||
| 266 | this_char); | 271 | this_char); |
| 267 | return EINVAL; | 272 | return EINVAL; |
| 268 | } | 273 | } |
| 269 | iosize = simple_strtoul(value, &eov, 10); | 274 | if (kstrtoint(value, 10, &iosize)) |
| 275 | return EINVAL; | ||
| 270 | iosizelog = ffs(iosize) - 1; | 276 | iosizelog = ffs(iosize) - 1; |
| 271 | } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) { | 277 | } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) { |
| 272 | if (!value || !*value) { | 278 | if (!value || !*value) { |
| @@ -274,7 +280,8 @@ xfs_parseargs( | |||
| 274 | this_char); | 280 | this_char); |
| 275 | return EINVAL; | 281 | return EINVAL; |
| 276 | } | 282 | } |
| 277 | iosize = suffix_strtoul(value, &eov, 10); | 283 | if (suffix_kstrtoint(value, 10, &iosize)) |
| 284 | return EINVAL; | ||
| 278 | iosizelog = ffs(iosize) - 1; | 285 | iosizelog = ffs(iosize) - 1; |
| 279 | } else if (!strcmp(this_char, MNTOPT_GRPID) || | 286 | } else if (!strcmp(this_char, MNTOPT_GRPID) || |
| 280 | !strcmp(this_char, MNTOPT_BSDGROUPS)) { | 287 | !strcmp(this_char, MNTOPT_BSDGROUPS)) { |
| @@ -296,14 +303,16 @@ xfs_parseargs( | |||
| 296 | this_char); | 303 | this_char); |
| 297 | return EINVAL; | 304 | return EINVAL; |
| 298 | } | 305 | } |
| 299 | dsunit = simple_strtoul(value, &eov, 10); | 306 | if (kstrtoint(value, 10, &dsunit)) |
| 307 | return EINVAL; | ||
| 300 | } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { | 308 | } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { |
| 301 | if (!value || !*value) { | 309 | if (!value || !*value) { |
| 302 | xfs_warn(mp, "%s option requires an argument", | 310 | xfs_warn(mp, "%s option requires an argument", |
| 303 | this_char); | 311 | this_char); |
| 304 | return EINVAL; | 312 | return EINVAL; |
| 305 | } | 313 | } |
| 306 | dswidth = simple_strtoul(value, &eov, 10); | 314 | if (kstrtoint(value, 10, &dswidth)) |
| 315 | return EINVAL; | ||
| 307 | } else if (!strcmp(this_char, MNTOPT_32BITINODE)) { | 316 | } else if (!strcmp(this_char, MNTOPT_32BITINODE)) { |
| 308 | mp->m_flags |= XFS_MOUNT_SMALL_INUMS; | 317 | mp->m_flags |= XFS_MOUNT_SMALL_INUMS; |
| 309 | } else if (!strcmp(this_char, MNTOPT_64BITINODE)) { | 318 | } else if (!strcmp(this_char, MNTOPT_64BITINODE)) { |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 06ed520a767f..2fd7c1ff1d21 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
| @@ -37,14 +37,45 @@ | |||
| 37 | #include "xfs_extent_busy.h" | 37 | #include "xfs_extent_busy.h" |
| 38 | #include "xfs_bmap.h" | 38 | #include "xfs_bmap.h" |
| 39 | #include "xfs_quota.h" | 39 | #include "xfs_quota.h" |
| 40 | #include "xfs_qm.h" | ||
| 40 | #include "xfs_trans_priv.h" | 41 | #include "xfs_trans_priv.h" |
| 41 | #include "xfs_trans_space.h" | 42 | #include "xfs_trans_space.h" |
| 42 | #include "xfs_inode_item.h" | 43 | #include "xfs_inode_item.h" |
| 44 | #include "xfs_log_priv.h" | ||
| 45 | #include "xfs_buf_item.h" | ||
| 43 | #include "xfs_trace.h" | 46 | #include "xfs_trace.h" |
| 44 | 47 | ||
| 45 | kmem_zone_t *xfs_trans_zone; | 48 | kmem_zone_t *xfs_trans_zone; |
| 46 | kmem_zone_t *xfs_log_item_desc_zone; | 49 | kmem_zone_t *xfs_log_item_desc_zone; |
| 47 | 50 | ||
| 51 | /* | ||
| 52 | * A buffer has a format structure overhead in the log in addition | ||
| 53 | * to the data, so we need to take this into account when reserving | ||
| 54 | * space in a transaction for a buffer. Round the space required up | ||
| 55 | * to a multiple of 128 bytes so that we don't change the historical | ||
| 56 | * reservation that has been used for this overhead. | ||
| 57 | */ | ||
| 58 | STATIC uint | ||
| 59 | xfs_buf_log_overhead(void) | ||
| 60 | { | ||
| 61 | return round_up(sizeof(struct xlog_op_header) + | ||
| 62 | sizeof(struct xfs_buf_log_format), 128); | ||
| 63 | } | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Calculate out transaction log reservation per item in bytes. | ||
| 67 | * | ||
| 68 | * The nbufs argument is used to indicate the number of items that | ||
| 69 | * will be changed in a transaction. size is used to tell how many | ||
| 70 | * bytes should be reserved per item. | ||
| 71 | */ | ||
| 72 | STATIC uint | ||
| 73 | xfs_calc_buf_res( | ||
| 74 | uint nbufs, | ||
| 75 | uint size) | ||
| 76 | { | ||
| 77 | return nbufs * (size + xfs_buf_log_overhead()); | ||
| 78 | } | ||
| 48 | 79 | ||
| 49 | /* | 80 | /* |
| 50 | * Various log reservation values. | 81 | * Various log reservation values. |
| @@ -85,18 +116,15 @@ xfs_calc_write_reservation( | |||
| 85 | struct xfs_mount *mp) | 116 | struct xfs_mount *mp) |
| 86 | { | 117 | { |
| 87 | return XFS_DQUOT_LOGRES(mp) + | 118 | return XFS_DQUOT_LOGRES(mp) + |
| 88 | MAX((mp->m_sb.sb_inodesize + | 119 | MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 89 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + | 120 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), |
| 90 | 2 * mp->m_sb.sb_sectsize + | 121 | XFS_FSB_TO_B(mp, 1)) + |
| 91 | mp->m_sb.sb_sectsize + | 122 | xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + |
| 92 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | 123 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2), |
| 93 | 128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + | 124 | XFS_FSB_TO_B(mp, 1))), |
| 94 | XFS_ALLOCFREE_LOG_COUNT(mp, 2))), | 125 | (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + |
| 95 | (2 * mp->m_sb.sb_sectsize + | 126 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2), |
| 96 | 2 * mp->m_sb.sb_sectsize + | 127 | XFS_FSB_TO_B(mp, 1)))); |
| 97 | mp->m_sb.sb_sectsize + | ||
| 98 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 99 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 100 | } | 128 | } |
| 101 | 129 | ||
| 102 | /* | 130 | /* |
| @@ -117,18 +145,17 @@ xfs_calc_itruncate_reservation( | |||
| 117 | struct xfs_mount *mp) | 145 | struct xfs_mount *mp) |
| 118 | { | 146 | { |
| 119 | return XFS_DQUOT_LOGRES(mp) + | 147 | return XFS_DQUOT_LOGRES(mp) + |
| 120 | MAX((mp->m_sb.sb_inodesize + | 148 | MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 121 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + | 149 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1, |
| 122 | 128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))), | 150 | XFS_FSB_TO_B(mp, 1))), |
| 123 | (4 * mp->m_sb.sb_sectsize + | 151 | (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + |
| 124 | 4 * mp->m_sb.sb_sectsize + | 152 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 4), |
| 125 | mp->m_sb.sb_sectsize + | 153 | XFS_FSB_TO_B(mp, 1)) + |
| 126 | XFS_ALLOCFREE_LOG_RES(mp, 4) + | 154 | xfs_calc_buf_res(5, 0) + |
| 127 | 128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)) + | 155 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 128 | 128 * 5 + | 156 | XFS_FSB_TO_B(mp, 1)) + |
| 129 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 157 | xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) + |
| 130 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | 158 | mp->m_in_maxlevels, 0))); |
| 131 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 132 | } | 159 | } |
| 133 | 160 | ||
| 134 | /* | 161 | /* |
| @@ -148,14 +175,12 @@ xfs_calc_rename_reservation( | |||
| 148 | struct xfs_mount *mp) | 175 | struct xfs_mount *mp) |
| 149 | { | 176 | { |
| 150 | return XFS_DQUOT_LOGRES(mp) + | 177 | return XFS_DQUOT_LOGRES(mp) + |
| 151 | MAX((4 * mp->m_sb.sb_inodesize + | 178 | MAX((xfs_calc_buf_res(4, mp->m_sb.sb_inodesize) + |
| 152 | 2 * XFS_DIROP_LOG_RES(mp) + | 179 | xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp), |
| 153 | 128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp))), | 180 | XFS_FSB_TO_B(mp, 1))), |
| 154 | (3 * mp->m_sb.sb_sectsize + | 181 | (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) + |
| 155 | 3 * mp->m_sb.sb_sectsize + | 182 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 3), |
| 156 | mp->m_sb.sb_sectsize + | 183 | XFS_FSB_TO_B(mp, 1)))); |
| 157 | XFS_ALLOCFREE_LOG_RES(mp, 3) + | ||
| 158 | 128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3)))); | ||
| 159 | } | 184 | } |
| 160 | 185 | ||
| 161 | /* | 186 | /* |
| @@ -175,15 +200,12 @@ xfs_calc_link_reservation( | |||
| 175 | struct xfs_mount *mp) | 200 | struct xfs_mount *mp) |
| 176 | { | 201 | { |
| 177 | return XFS_DQUOT_LOGRES(mp) + | 202 | return XFS_DQUOT_LOGRES(mp) + |
| 178 | MAX((mp->m_sb.sb_inodesize + | 203 | MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + |
| 179 | mp->m_sb.sb_inodesize + | 204 | xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), |
| 180 | XFS_DIROP_LOG_RES(mp) + | 205 | XFS_FSB_TO_B(mp, 1))), |
| 181 | 128 * (2 + XFS_DIROP_LOG_COUNT(mp))), | 206 | (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + |
| 182 | (mp->m_sb.sb_sectsize + | 207 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 183 | mp->m_sb.sb_sectsize + | 208 | XFS_FSB_TO_B(mp, 1)))); |
| 184 | mp->m_sb.sb_sectsize + | ||
| 185 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 186 | 128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 187 | } | 209 | } |
| 188 | 210 | ||
| 189 | /* | 211 | /* |
| @@ -203,15 +225,12 @@ xfs_calc_remove_reservation( | |||
| 203 | struct xfs_mount *mp) | 225 | struct xfs_mount *mp) |
| 204 | { | 226 | { |
| 205 | return XFS_DQUOT_LOGRES(mp) + | 227 | return XFS_DQUOT_LOGRES(mp) + |
| 206 | MAX((mp->m_sb.sb_inodesize + | 228 | MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + |
| 207 | mp->m_sb.sb_inodesize + | 229 | xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), |
| 208 | XFS_DIROP_LOG_RES(mp) + | 230 | XFS_FSB_TO_B(mp, 1))), |
| 209 | 128 * (2 + XFS_DIROP_LOG_COUNT(mp))), | 231 | (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + |
| 210 | (2 * mp->m_sb.sb_sectsize + | 232 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2), |
| 211 | 2 * mp->m_sb.sb_sectsize + | 233 | XFS_FSB_TO_B(mp, 1)))); |
| 212 | mp->m_sb.sb_sectsize + | ||
| 213 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | ||
| 214 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 215 | } | 234 | } |
| 216 | 235 | ||
| 217 | /* | 236 | /* |
| @@ -233,18 +252,18 @@ xfs_calc_symlink_reservation( | |||
| 233 | struct xfs_mount *mp) | 252 | struct xfs_mount *mp) |
| 234 | { | 253 | { |
| 235 | return XFS_DQUOT_LOGRES(mp) + | 254 | return XFS_DQUOT_LOGRES(mp) + |
| 236 | MAX((mp->m_sb.sb_inodesize + | 255 | MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + |
| 237 | mp->m_sb.sb_inodesize + | 256 | xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, 1)) + |
| 238 | XFS_FSB_TO_B(mp, 1) + | 257 | xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), |
| 239 | XFS_DIROP_LOG_RES(mp) + | 258 | XFS_FSB_TO_B(mp, 1)) + |
| 240 | 1024 + | 259 | xfs_calc_buf_res(1, 1024)), |
| 241 | 128 * (4 + XFS_DIROP_LOG_COUNT(mp))), | 260 | (xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + |
| 242 | (2 * mp->m_sb.sb_sectsize + | 261 | xfs_calc_buf_res(XFS_IALLOC_BLOCKS(mp), |
| 243 | XFS_FSB_TO_B(mp, XFS_IALLOC_BLOCKS(mp)) + | 262 | XFS_FSB_TO_B(mp, 1)) + |
| 244 | XFS_FSB_TO_B(mp, mp->m_in_maxlevels) + | 263 | xfs_calc_buf_res(mp->m_in_maxlevels, |
| 245 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 264 | XFS_FSB_TO_B(mp, 1)) + |
| 246 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | 265 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 247 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | 266 | XFS_FSB_TO_B(mp, 1)))); |
| 248 | } | 267 | } |
| 249 | 268 | ||
| 250 | /* | 269 | /* |
| @@ -267,18 +286,19 @@ xfs_calc_create_reservation( | |||
| 267 | struct xfs_mount *mp) | 286 | struct xfs_mount *mp) |
| 268 | { | 287 | { |
| 269 | return XFS_DQUOT_LOGRES(mp) + | 288 | return XFS_DQUOT_LOGRES(mp) + |
| 270 | MAX((mp->m_sb.sb_inodesize + | 289 | MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + |
| 271 | mp->m_sb.sb_inodesize + | 290 | xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + |
| 291 | (uint)XFS_FSB_TO_B(mp, 1) + | ||
| 292 | xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), | ||
| 293 | XFS_FSB_TO_B(mp, 1))), | ||
| 294 | (xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + | ||
| 272 | mp->m_sb.sb_sectsize + | 295 | mp->m_sb.sb_sectsize + |
| 273 | XFS_FSB_TO_B(mp, 1) + | 296 | xfs_calc_buf_res(XFS_IALLOC_BLOCKS(mp), |
| 274 | XFS_DIROP_LOG_RES(mp) + | 297 | XFS_FSB_TO_B(mp, 1)) + |
| 275 | 128 * (3 + XFS_DIROP_LOG_COUNT(mp))), | 298 | xfs_calc_buf_res(mp->m_in_maxlevels, |
| 276 | (3 * mp->m_sb.sb_sectsize + | 299 | XFS_FSB_TO_B(mp, 1)) + |
| 277 | XFS_FSB_TO_B(mp, XFS_IALLOC_BLOCKS(mp)) + | 300 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 278 | XFS_FSB_TO_B(mp, mp->m_in_maxlevels) + | 301 | XFS_FSB_TO_B(mp, 1)))); |
| 279 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | ||
| 280 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | ||
| 281 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)))); | ||
| 282 | } | 302 | } |
| 283 | 303 | ||
| 284 | /* | 304 | /* |
| @@ -306,16 +326,16 @@ xfs_calc_ifree_reservation( | |||
| 306 | struct xfs_mount *mp) | 326 | struct xfs_mount *mp) |
| 307 | { | 327 | { |
| 308 | return XFS_DQUOT_LOGRES(mp) + | 328 | return XFS_DQUOT_LOGRES(mp) + |
| 309 | mp->m_sb.sb_inodesize + | 329 | xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 310 | mp->m_sb.sb_sectsize + | 330 | xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + |
| 311 | mp->m_sb.sb_sectsize + | 331 | xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, 1)) + |
| 312 | XFS_FSB_TO_B(mp, 1) + | ||
| 313 | MAX((__uint16_t)XFS_FSB_TO_B(mp, 1), | 332 | MAX((__uint16_t)XFS_FSB_TO_B(mp, 1), |
| 314 | XFS_INODE_CLUSTER_SIZE(mp)) + | 333 | XFS_INODE_CLUSTER_SIZE(mp)) + |
| 315 | 128 * 5 + | 334 | xfs_calc_buf_res(1, 0) + |
| 316 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 335 | xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) + |
| 317 | 128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels + | 336 | mp->m_in_maxlevels, 0) + |
| 318 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | 337 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 338 | XFS_FSB_TO_B(mp, 1)); | ||
| 319 | } | 339 | } |
| 320 | 340 | ||
| 321 | /* | 341 | /* |
| @@ -343,9 +363,9 @@ STATIC uint | |||
| 343 | xfs_calc_growdata_reservation( | 363 | xfs_calc_growdata_reservation( |
| 344 | struct xfs_mount *mp) | 364 | struct xfs_mount *mp) |
| 345 | { | 365 | { |
| 346 | return mp->m_sb.sb_sectsize * 3 + | 366 | return xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + |
| 347 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 367 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 348 | 128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | 368 | XFS_FSB_TO_B(mp, 1)); |
| 349 | } | 369 | } |
| 350 | 370 | ||
| 351 | /* | 371 | /* |
| @@ -362,12 +382,12 @@ STATIC uint | |||
| 362 | xfs_calc_growrtalloc_reservation( | 382 | xfs_calc_growrtalloc_reservation( |
| 363 | struct xfs_mount *mp) | 383 | struct xfs_mount *mp) |
| 364 | { | 384 | { |
| 365 | return 2 * mp->m_sb.sb_sectsize + | 385 | return xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + |
| 366 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + | 386 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), |
| 367 | mp->m_sb.sb_inodesize + | 387 | XFS_FSB_TO_B(mp, 1)) + |
| 368 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 388 | xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 369 | 128 * (3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + | 389 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 370 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | 390 | XFS_FSB_TO_B(mp, 1)); |
| 371 | } | 391 | } |
| 372 | 392 | ||
| 373 | /* | 393 | /* |
| @@ -379,7 +399,7 @@ STATIC uint | |||
| 379 | xfs_calc_growrtzero_reservation( | 399 | xfs_calc_growrtzero_reservation( |
| 380 | struct xfs_mount *mp) | 400 | struct xfs_mount *mp) |
| 381 | { | 401 | { |
| 382 | return mp->m_sb.sb_blocksize + 128; | 402 | return xfs_calc_buf_res(1, mp->m_sb.sb_blocksize); |
| 383 | } | 403 | } |
| 384 | 404 | ||
| 385 | /* | 405 | /* |
| @@ -396,11 +416,10 @@ STATIC uint | |||
| 396 | xfs_calc_growrtfree_reservation( | 416 | xfs_calc_growrtfree_reservation( |
| 397 | struct xfs_mount *mp) | 417 | struct xfs_mount *mp) |
| 398 | { | 418 | { |
| 399 | return mp->m_sb.sb_sectsize + | 419 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + |
| 400 | 2 * mp->m_sb.sb_inodesize + | 420 | xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + |
| 401 | mp->m_sb.sb_blocksize + | 421 | xfs_calc_buf_res(1, mp->m_sb.sb_blocksize) + |
| 402 | mp->m_rsumsize + | 422 | xfs_calc_buf_res(1, mp->m_rsumsize); |
| 403 | 128 * 5; | ||
| 404 | } | 423 | } |
| 405 | 424 | ||
| 406 | /* | 425 | /* |
| @@ -411,7 +430,7 @@ STATIC uint | |||
| 411 | xfs_calc_swrite_reservation( | 430 | xfs_calc_swrite_reservation( |
| 412 | struct xfs_mount *mp) | 431 | struct xfs_mount *mp) |
| 413 | { | 432 | { |
| 414 | return mp->m_sb.sb_inodesize + 128; | 433 | return xfs_calc_buf_res(1, mp->m_sb.sb_inodesize); |
| 415 | } | 434 | } |
| 416 | 435 | ||
| 417 | /* | 436 | /* |
| @@ -421,7 +440,7 @@ xfs_calc_swrite_reservation( | |||
| 421 | STATIC uint | 440 | STATIC uint |
| 422 | xfs_calc_writeid_reservation(xfs_mount_t *mp) | 441 | xfs_calc_writeid_reservation(xfs_mount_t *mp) |
| 423 | { | 442 | { |
| 424 | return mp->m_sb.sb_inodesize + 128; | 443 | return xfs_calc_buf_res(1, mp->m_sb.sb_inodesize); |
| 425 | } | 444 | } |
| 426 | 445 | ||
| 427 | /* | 446 | /* |
| @@ -437,13 +456,13 @@ xfs_calc_addafork_reservation( | |||
| 437 | struct xfs_mount *mp) | 456 | struct xfs_mount *mp) |
| 438 | { | 457 | { |
| 439 | return XFS_DQUOT_LOGRES(mp) + | 458 | return XFS_DQUOT_LOGRES(mp) + |
| 440 | mp->m_sb.sb_inodesize + | 459 | xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 441 | mp->m_sb.sb_sectsize * 2 + | 460 | xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + |
| 442 | mp->m_dirblksize + | 461 | xfs_calc_buf_res(1, mp->m_dirblksize) + |
| 443 | XFS_FSB_TO_B(mp, XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + | 462 | xfs_calc_buf_res(XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1, |
| 444 | XFS_ALLOCFREE_LOG_RES(mp, 1) + | 463 | XFS_FSB_TO_B(mp, 1)) + |
| 445 | 128 * (4 + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1 + | 464 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1), |
| 446 | XFS_ALLOCFREE_LOG_COUNT(mp, 1)); | 465 | XFS_FSB_TO_B(mp, 1)); |
| 447 | } | 466 | } |
| 448 | 467 | ||
| 449 | /* | 468 | /* |
| @@ -461,35 +480,51 @@ STATIC uint | |||
| 461 | xfs_calc_attrinval_reservation( | 480 | xfs_calc_attrinval_reservation( |
| 462 | struct xfs_mount *mp) | 481 | struct xfs_mount *mp) |
| 463 | { | 482 | { |
| 464 | return MAX((mp->m_sb.sb_inodesize + | 483 | return MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 465 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + | 484 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK), |
| 466 | 128 * (1 + XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))), | 485 | XFS_FSB_TO_B(mp, 1))), |
| 467 | (4 * mp->m_sb.sb_sectsize + | 486 | (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + |
| 468 | 4 * mp->m_sb.sb_sectsize + | 487 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 4), |
| 469 | mp->m_sb.sb_sectsize + | 488 | XFS_FSB_TO_B(mp, 1)))); |
| 470 | XFS_ALLOCFREE_LOG_RES(mp, 4) + | ||
| 471 | 128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)))); | ||
| 472 | } | 489 | } |
| 473 | 490 | ||
| 474 | /* | 491 | /* |
| 475 | * Setting an attribute. | 492 | * Setting an attribute at mount time. |
| 476 | * the inode getting the attribute | 493 | * the inode getting the attribute |
| 477 | * the superblock for allocations | 494 | * the superblock for allocations |
| 478 | * the agfs extents are allocated from | 495 | * the agfs extents are allocated from |
| 479 | * the attribute btree * max depth | 496 | * the attribute btree * max depth |
| 480 | * the inode allocation btree | 497 | * the inode allocation btree |
| 481 | * Since attribute transaction space is dependent on the size of the attribute, | 498 | * Since attribute transaction space is dependent on the size of the attribute, |
| 482 | * the calculation is done partially at mount time and partially at runtime. | 499 | * the calculation is done partially at mount time and partially at runtime(see |
| 500 | * below). | ||
| 483 | */ | 501 | */ |
| 484 | STATIC uint | 502 | STATIC uint |
| 485 | xfs_calc_attrset_reservation( | 503 | xfs_calc_attrsetm_reservation( |
| 486 | struct xfs_mount *mp) | 504 | struct xfs_mount *mp) |
| 487 | { | 505 | { |
| 488 | return XFS_DQUOT_LOGRES(mp) + | 506 | return XFS_DQUOT_LOGRES(mp) + |
| 489 | mp->m_sb.sb_inodesize + | 507 | xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 490 | mp->m_sb.sb_sectsize + | 508 | xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + |
| 491 | XFS_FSB_TO_B(mp, XFS_DA_NODE_MAXDEPTH) + | 509 | xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1)); |
| 492 | 128 * (2 + XFS_DA_NODE_MAXDEPTH); | 510 | } |
| 511 | |||
| 512 | /* | ||
| 513 | * Setting an attribute at runtime, transaction space unit per block. | ||
| 514 | * the superblock for allocations: sector size | ||
| 515 | * the inode bmap btree could join or split: max depth * block size | ||
| 516 | * Since the runtime attribute transaction space is dependent on the total | ||
| 517 | * blocks needed for the 1st bmap, here we calculate out the space unit for | ||
| 518 | * one block so that the caller could figure out the total space according | ||
| 519 | * to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp). | ||
| 520 | */ | ||
| 521 | STATIC uint | ||
| 522 | xfs_calc_attrsetrt_reservation( | ||
| 523 | struct xfs_mount *mp) | ||
| 524 | { | ||
| 525 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) + | ||
| 526 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK), | ||
| 527 | XFS_FSB_TO_B(mp, 1)); | ||
| 493 | } | 528 | } |
| 494 | 529 | ||
| 495 | /* | 530 | /* |
| @@ -508,16 +543,15 @@ xfs_calc_attrrm_reservation( | |||
| 508 | struct xfs_mount *mp) | 543 | struct xfs_mount *mp) |
| 509 | { | 544 | { |
| 510 | return XFS_DQUOT_LOGRES(mp) + | 545 | return XFS_DQUOT_LOGRES(mp) + |
| 511 | MAX((mp->m_sb.sb_inodesize + | 546 | MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + |
| 512 | XFS_FSB_TO_B(mp, XFS_DA_NODE_MAXDEPTH) + | 547 | xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, |
| 513 | XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + | 548 | XFS_FSB_TO_B(mp, 1)) + |
| 514 | 128 * (1 + XFS_DA_NODE_MAXDEPTH + | 549 | (uint)XFS_FSB_TO_B(mp, |
| 515 | XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))), | 550 | XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + |
| 516 | (2 * mp->m_sb.sb_sectsize + | 551 | xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 0)), |
| 517 | 2 * mp->m_sb.sb_sectsize + | 552 | (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) + |
| 518 | mp->m_sb.sb_sectsize + | 553 | xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2), |
| 519 | XFS_ALLOCFREE_LOG_RES(mp, 2) + | 554 | XFS_FSB_TO_B(mp, 1)))); |
| 520 | 128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2)))); | ||
| 521 | } | 555 | } |
| 522 | 556 | ||
| 523 | /* | 557 | /* |
| @@ -527,7 +561,78 @@ STATIC uint | |||
| 527 | xfs_calc_clear_agi_bucket_reservation( | 561 | xfs_calc_clear_agi_bucket_reservation( |
| 528 | struct xfs_mount *mp) | 562 | struct xfs_mount *mp) |
| 529 | { | 563 | { |
| 530 | return mp->m_sb.sb_sectsize + 128; | 564 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); |
| 565 | } | ||
| 566 | |||
| 567 | /* | ||
| 568 | * Clearing the quotaflags in the superblock. | ||
| 569 | * the super block for changing quota flags: sector size | ||
| 570 | */ | ||
| 571 | STATIC uint | ||
| 572 | xfs_calc_qm_sbchange_reservation( | ||
| 573 | struct xfs_mount *mp) | ||
| 574 | { | ||
| 575 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); | ||
| 576 | } | ||
| 577 | |||
| 578 | /* | ||
| 579 | * Adjusting quota limits. | ||
| 580 | * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot) | ||
| 581 | */ | ||
| 582 | STATIC uint | ||
| 583 | xfs_calc_qm_setqlim_reservation( | ||
| 584 | struct xfs_mount *mp) | ||
| 585 | { | ||
| 586 | return xfs_calc_buf_res(1, sizeof(struct xfs_disk_dquot)); | ||
| 587 | } | ||
| 588 | |||
| 589 | /* | ||
| 590 | * Allocating quota on disk if needed. | ||
| 591 | * the write transaction log space: XFS_WRITE_LOG_RES(mp) | ||
| 592 | * the unit of quota allocation: one system block size | ||
| 593 | */ | ||
| 594 | STATIC uint | ||
| 595 | xfs_calc_qm_dqalloc_reservation( | ||
| 596 | struct xfs_mount *mp) | ||
| 597 | { | ||
| 598 | return XFS_WRITE_LOG_RES(mp) + | ||
| 599 | xfs_calc_buf_res(1, | ||
| 600 | XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1); | ||
| 601 | } | ||
| 602 | |||
| 603 | /* | ||
| 604 | * Turning off quotas. | ||
| 605 | * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 | ||
| 606 | * the superblock for the quota flags: sector size | ||
| 607 | */ | ||
| 608 | STATIC uint | ||
| 609 | xfs_calc_qm_quotaoff_reservation( | ||
| 610 | struct xfs_mount *mp) | ||
| 611 | { | ||
| 612 | return sizeof(struct xfs_qoff_logitem) * 2 + | ||
| 613 | xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); | ||
| 614 | } | ||
| 615 | |||
| 616 | /* | ||
| 617 | * End of turning off quotas. | ||
| 618 | * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 | ||
| 619 | */ | ||
| 620 | STATIC uint | ||
| 621 | xfs_calc_qm_quotaoff_end_reservation( | ||
| 622 | struct xfs_mount *mp) | ||
| 623 | { | ||
| 624 | return sizeof(struct xfs_qoff_logitem) * 2; | ||
| 625 | } | ||
| 626 | |||
| 627 | /* | ||
| 628 | * Syncing the incore super block changes to disk. | ||
| 629 | * the super block to reflect the changes: sector size | ||
| 630 | */ | ||
| 631 | STATIC uint | ||
| 632 | xfs_calc_sb_reservation( | ||
| 633 | struct xfs_mount *mp) | ||
| 634 | { | ||
| 635 | return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize); | ||
| 531 | } | 636 | } |
| 532 | 637 | ||
| 533 | /* | 638 | /* |
| @@ -555,12 +660,19 @@ xfs_trans_init( | |||
| 555 | resp->tr_writeid = xfs_calc_writeid_reservation(mp); | 660 | resp->tr_writeid = xfs_calc_writeid_reservation(mp); |
| 556 | resp->tr_addafork = xfs_calc_addafork_reservation(mp); | 661 | resp->tr_addafork = xfs_calc_addafork_reservation(mp); |
| 557 | resp->tr_attrinval = xfs_calc_attrinval_reservation(mp); | 662 | resp->tr_attrinval = xfs_calc_attrinval_reservation(mp); |
| 558 | resp->tr_attrset = xfs_calc_attrset_reservation(mp); | 663 | resp->tr_attrsetm = xfs_calc_attrsetm_reservation(mp); |
| 664 | resp->tr_attrsetrt = xfs_calc_attrsetrt_reservation(mp); | ||
| 559 | resp->tr_attrrm = xfs_calc_attrrm_reservation(mp); | 665 | resp->tr_attrrm = xfs_calc_attrrm_reservation(mp); |
| 560 | resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp); | 666 | resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp); |
| 561 | resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp); | 667 | resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp); |
| 562 | resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp); | 668 | resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp); |
| 563 | resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp); | 669 | resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp); |
| 670 | resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp); | ||
| 671 | resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); | ||
| 672 | resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp); | ||
| 673 | resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp); | ||
| 674 | resp->tr_qm_equotaoff = xfs_calc_qm_quotaoff_end_reservation(mp); | ||
| 675 | resp->tr_sb = xfs_calc_sb_reservation(mp); | ||
| 564 | } | 676 | } |
| 565 | 677 | ||
| 566 | /* | 678 | /* |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index c6c0601abd7a..cd29f6171021 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
| @@ -252,17 +252,19 @@ struct xfs_log_item_desc { | |||
| 252 | * as long as SWRITE logs the entire inode core | 252 | * as long as SWRITE logs the entire inode core |
| 253 | */ | 253 | */ |
| 254 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 254 | #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) |
| 255 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) | 255 | #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) |
| 256 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) | 256 | #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) |
| 257 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) | 257 | #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) |
| 258 | #define XFS_ATTRSET_LOG_RES(mp, ext) \ | 258 | #define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetm) |
| 259 | ((mp)->m_reservations.tr_attrset + \ | 259 | #define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetrt) |
| 260 | (ext * (mp)->m_sb.sb_sectsize) + \ | 260 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) |
| 261 | (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \ | ||
| 262 | (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))))) | ||
| 263 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) | ||
| 264 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) | 261 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) |
| 265 | 262 | #define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange) | |
| 263 | #define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim) | ||
| 264 | #define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_qm_dqalloc) | ||
| 265 | #define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_reservations.tr_qm_quotaoff) | ||
| 266 | #define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_reservations.tr_qm_equotaoff) | ||
| 267 | #define XFS_SB_LOG_RES(mp) ((mp)->m_reservations.tr_sb) | ||
| 266 | 268 | ||
| 267 | /* | 269 | /* |
| 268 | * Various log count values. | 270 | * Various log count values. |
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 6011ee661339..0eda7254305f 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
| @@ -55,20 +55,6 @@ xfs_ail_check( | |||
| 55 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0); | 55 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0); |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | #ifdef XFS_TRANS_DEBUG | ||
| 59 | /* | ||
| 60 | * Walk the list checking lsn ordering, and that every entry has the | ||
| 61 | * XFS_LI_IN_AIL flag set. This is really expensive, so only do it | ||
| 62 | * when specifically debugging the transaction subsystem. | ||
| 63 | */ | ||
| 64 | prev_lip = list_entry(&ailp->xa_ail, xfs_log_item_t, li_ail); | ||
| 65 | list_for_each_entry(lip, &ailp->xa_ail, li_ail) { | ||
| 66 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
| 67 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0); | ||
| 68 | ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0); | ||
| 69 | prev_lip = lip; | ||
| 70 | } | ||
| 71 | #endif /* XFS_TRANS_DEBUG */ | ||
| 72 | } | 58 | } |
| 73 | #else /* !DEBUG */ | 59 | #else /* !DEBUG */ |
| 74 | #define xfs_ail_check(a,l) | 60 | #define xfs_ail_check(a,l) |
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index 0c7fa54f309e..642c2d6e1db1 100644 --- a/fs/xfs/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c | |||
| @@ -516,7 +516,7 @@ xfs_trans_unreserve_and_mod_dquots( | |||
| 516 | int i, j; | 516 | int i, j; |
| 517 | xfs_dquot_t *dqp; | 517 | xfs_dquot_t *dqp; |
| 518 | xfs_dqtrx_t *qtrx, *qa; | 518 | xfs_dqtrx_t *qtrx, *qa; |
| 519 | boolean_t locked; | 519 | bool locked; |
| 520 | 520 | ||
| 521 | if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY)) | 521 | if (!tp->t_dqinfo || !(tp->t_flags & XFS_TRANS_DQ_DIRTY)) |
| 522 | return; | 522 | return; |
| @@ -537,17 +537,17 @@ xfs_trans_unreserve_and_mod_dquots( | |||
| 537 | * about the number of blocks used field, or deltas. | 537 | * about the number of blocks used field, or deltas. |
| 538 | * Also we don't bother to zero the fields. | 538 | * Also we don't bother to zero the fields. |
| 539 | */ | 539 | */ |
| 540 | locked = B_FALSE; | 540 | locked = false; |
| 541 | if (qtrx->qt_blk_res) { | 541 | if (qtrx->qt_blk_res) { |
| 542 | xfs_dqlock(dqp); | 542 | xfs_dqlock(dqp); |
| 543 | locked = B_TRUE; | 543 | locked = true; |
| 544 | dqp->q_res_bcount -= | 544 | dqp->q_res_bcount -= |
| 545 | (xfs_qcnt_t)qtrx->qt_blk_res; | 545 | (xfs_qcnt_t)qtrx->qt_blk_res; |
| 546 | } | 546 | } |
| 547 | if (qtrx->qt_ino_res) { | 547 | if (qtrx->qt_ino_res) { |
| 548 | if (!locked) { | 548 | if (!locked) { |
| 549 | xfs_dqlock(dqp); | 549 | xfs_dqlock(dqp); |
| 550 | locked = B_TRUE; | 550 | locked = true; |
| 551 | } | 551 | } |
| 552 | dqp->q_res_icount -= | 552 | dqp->q_res_icount -= |
| 553 | (xfs_qcnt_t)qtrx->qt_ino_res; | 553 | (xfs_qcnt_t)qtrx->qt_ino_res; |
| @@ -556,7 +556,7 @@ xfs_trans_unreserve_and_mod_dquots( | |||
| 556 | if (qtrx->qt_rtblk_res) { | 556 | if (qtrx->qt_rtblk_res) { |
| 557 | if (!locked) { | 557 | if (!locked) { |
| 558 | xfs_dqlock(dqp); | 558 | xfs_dqlock(dqp); |
| 559 | locked = B_TRUE; | 559 | locked = true; |
| 560 | } | 560 | } |
| 561 | dqp->q_res_rtbcount -= | 561 | dqp->q_res_rtbcount -= |
| 562 | (xfs_qcnt_t)qtrx->qt_rtblk_res; | 562 | (xfs_qcnt_t)qtrx->qt_rtblk_res; |
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c index d2eee20d5f5b..ac6d567704db 100644 --- a/fs/xfs/xfs_trans_inode.c +++ b/fs/xfs/xfs_trans_inode.c | |||
| @@ -33,14 +33,6 @@ | |||
| 33 | #include "xfs_inode_item.h" | 33 | #include "xfs_inode_item.h" |
| 34 | #include "xfs_trace.h" | 34 | #include "xfs_trace.h" |
| 35 | 35 | ||
| 36 | #ifdef XFS_TRANS_DEBUG | ||
| 37 | STATIC void | ||
| 38 | xfs_trans_inode_broot_debug( | ||
| 39 | xfs_inode_t *ip); | ||
| 40 | #else | ||
| 41 | #define xfs_trans_inode_broot_debug(ip) | ||
| 42 | #endif | ||
| 43 | |||
| 44 | /* | 36 | /* |
| 45 | * Add a locked inode to the transaction. | 37 | * Add a locked inode to the transaction. |
| 46 | * | 38 | * |
| @@ -67,8 +59,6 @@ xfs_trans_ijoin( | |||
| 67 | * Get a log_item_desc to point at the new item. | 59 | * Get a log_item_desc to point at the new item. |
| 68 | */ | 60 | */ |
| 69 | xfs_trans_add_item(tp, &iip->ili_item); | 61 | xfs_trans_add_item(tp, &iip->ili_item); |
| 70 | |||
| 71 | xfs_trans_inode_broot_debug(ip); | ||
| 72 | } | 62 | } |
| 73 | 63 | ||
| 74 | /* | 64 | /* |
| @@ -135,34 +125,3 @@ xfs_trans_log_inode( | |||
| 135 | flags |= ip->i_itemp->ili_last_fields; | 125 | flags |= ip->i_itemp->ili_last_fields; |
| 136 | ip->i_itemp->ili_fields |= flags; | 126 | ip->i_itemp->ili_fields |= flags; |
| 137 | } | 127 | } |
| 138 | |||
| 139 | #ifdef XFS_TRANS_DEBUG | ||
| 140 | /* | ||
| 141 | * Keep track of the state of the inode btree root to make sure we | ||
| 142 | * log it properly. | ||
| 143 | */ | ||
| 144 | STATIC void | ||
| 145 | xfs_trans_inode_broot_debug( | ||
| 146 | xfs_inode_t *ip) | ||
| 147 | { | ||
| 148 | xfs_inode_log_item_t *iip; | ||
| 149 | |||
| 150 | ASSERT(ip->i_itemp != NULL); | ||
| 151 | iip = ip->i_itemp; | ||
| 152 | if (iip->ili_root_size != 0) { | ||
| 153 | ASSERT(iip->ili_orig_root != NULL); | ||
| 154 | kmem_free(iip->ili_orig_root); | ||
| 155 | iip->ili_root_size = 0; | ||
| 156 | iip->ili_orig_root = NULL; | ||
| 157 | } | ||
| 158 | if (ip->i_d.di_format == XFS_DINODE_FMT_BTREE) { | ||
| 159 | ASSERT((ip->i_df.if_broot != NULL) && | ||
| 160 | (ip->i_df.if_broot_bytes > 0)); | ||
| 161 | iip->ili_root_size = ip->i_df.if_broot_bytes; | ||
| 162 | iip->ili_orig_root = | ||
| 163 | (char*)kmem_alloc(iip->ili_root_size, KM_SLEEP); | ||
| 164 | memcpy(iip->ili_orig_root, (char*)(ip->i_df.if_broot), | ||
| 165 | iip->ili_root_size); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | #endif | ||
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h index 7a41874f4c20..61ba1cfa974c 100644 --- a/fs/xfs/xfs_types.h +++ b/fs/xfs/xfs_types.h | |||
| @@ -32,7 +32,6 @@ typedef unsigned int __uint32_t; | |||
| 32 | typedef signed long long int __int64_t; | 32 | typedef signed long long int __int64_t; |
| 33 | typedef unsigned long long int __uint64_t; | 33 | typedef unsigned long long int __uint64_t; |
| 34 | 34 | ||
| 35 | typedef enum { B_FALSE,B_TRUE } boolean_t; | ||
| 36 | typedef __uint32_t prid_t; /* project ID */ | 35 | typedef __uint32_t prid_t; /* project ID */ |
| 37 | typedef __uint32_t inst_t; /* an instruction */ | 36 | typedef __uint32_t inst_t; /* an instruction */ |
| 38 | 37 | ||
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index d95f565a390e..77ad74834baa 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -725,7 +725,7 @@ xfs_create( | |||
| 725 | int error; | 725 | int error; |
| 726 | xfs_bmap_free_t free_list; | 726 | xfs_bmap_free_t free_list; |
| 727 | xfs_fsblock_t first_block; | 727 | xfs_fsblock_t first_block; |
| 728 | boolean_t unlock_dp_on_error = B_FALSE; | 728 | bool unlock_dp_on_error = false; |
| 729 | uint cancel_flags; | 729 | uint cancel_flags; |
| 730 | int committed; | 730 | int committed; |
| 731 | prid_t prid; | 731 | prid_t prid; |
| @@ -794,7 +794,7 @@ xfs_create( | |||
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); | 796 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
| 797 | unlock_dp_on_error = B_TRUE; | 797 | unlock_dp_on_error = true; |
| 798 | 798 | ||
| 799 | xfs_bmap_init(&free_list, &first_block); | 799 | xfs_bmap_init(&free_list, &first_block); |
| 800 | 800 | ||
| @@ -830,7 +830,7 @@ xfs_create( | |||
| 830 | * error path. | 830 | * error path. |
| 831 | */ | 831 | */ |
| 832 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 832 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
| 833 | unlock_dp_on_error = B_FALSE; | 833 | unlock_dp_on_error = false; |
| 834 | 834 | ||
| 835 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, | 835 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, |
| 836 | &first_block, &free_list, resblks ? | 836 | &first_block, &free_list, resblks ? |
| @@ -1367,7 +1367,7 @@ xfs_symlink( | |||
| 1367 | int pathlen; | 1367 | int pathlen; |
| 1368 | xfs_bmap_free_t free_list; | 1368 | xfs_bmap_free_t free_list; |
| 1369 | xfs_fsblock_t first_block; | 1369 | xfs_fsblock_t first_block; |
| 1370 | boolean_t unlock_dp_on_error = B_FALSE; | 1370 | bool unlock_dp_on_error = false; |
| 1371 | uint cancel_flags; | 1371 | uint cancel_flags; |
| 1372 | int committed; | 1372 | int committed; |
| 1373 | xfs_fileoff_t first_fsb; | 1373 | xfs_fileoff_t first_fsb; |
| @@ -1438,7 +1438,7 @@ xfs_symlink( | |||
| 1438 | } | 1438 | } |
| 1439 | 1439 | ||
| 1440 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); | 1440 | xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); |
| 1441 | unlock_dp_on_error = B_TRUE; | 1441 | unlock_dp_on_error = true; |
| 1442 | 1442 | ||
| 1443 | /* | 1443 | /* |
| 1444 | * Check whether the directory allows new symlinks or not. | 1444 | * Check whether the directory allows new symlinks or not. |
| @@ -1484,7 +1484,7 @@ xfs_symlink( | |||
| 1484 | * error path. | 1484 | * error path. |
| 1485 | */ | 1485 | */ |
| 1486 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1486 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
| 1487 | unlock_dp_on_error = B_FALSE; | 1487 | unlock_dp_on_error = false; |
| 1488 | 1488 | ||
| 1489 | /* | 1489 | /* |
| 1490 | * Also attach the dquot(s) to it, if applicable. | 1490 | * Also attach the dquot(s) to it, if applicable. |
