jfs_dmap.c (95d465fd750897ab32462a6702fbfe1b122cbbc0) | jfs_dmap.c (4d81715fc5dfa1680ad47d7edf3ac4a74c5bf104) |
---|---|
1/* 2 * Copyright (C) International Business Machines Corp., 2000-2004 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 389 unchanged lines hidden (view full) --- 398 * FUNCTION: update the allocation state (free or allocate) of the 399 * specified block range in the persistent block allocation map. 400 * 401 * the blocks will be updated in the persistent map one 402 * dmap at a time. 403 * 404 * PARAMETERS: 405 * ipbmap - pointer to in-core inode for the block map. | 1/* 2 * Copyright (C) International Business Machines Corp., 2000-2004 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 389 unchanged lines hidden (view full) --- 398 * FUNCTION: update the allocation state (free or allocate) of the 399 * specified block range in the persistent block allocation map. 400 * 401 * the blocks will be updated in the persistent map one 402 * dmap at a time. 403 * 404 * PARAMETERS: 405 * ipbmap - pointer to in-core inode for the block map. |
406 * free - TRUE if block range is to be freed from the persistent 407 * map; FALSE if it is to be allocated. | 406 * free - 'true' if block range is to be freed from the persistent 407 * map; 'false' if it is to be allocated. |
408 * blkno - starting block number of the range. 409 * nblocks - number of contiguous blocks in the range. 410 * tblk - transaction block; 411 * 412 * RETURN VALUES: 413 * 0 - success 414 * -EIO - i/o error 415 */ --- 1973 unchanged lines hidden (view full) --- 2389 * be adjusted. 2390 * PARAMETERS: 2391 * bmp - pointer to bmap descriptor 2392 * blkno - the first block of a block range within a dmap. it is 2393 * the allocation or deallocation of this block range that 2394 * requires the dmap control page to be adjusted. 2395 * newval - the new value of the lower level dmap or dmap control 2396 * page root. | 408 * blkno - starting block number of the range. 409 * nblocks - number of contiguous blocks in the range. 410 * tblk - transaction block; 411 * 412 * RETURN VALUES: 413 * 0 - success 414 * -EIO - i/o error 415 */ --- 1973 unchanged lines hidden (view full) --- 2389 * be adjusted. 2390 * PARAMETERS: 2391 * bmp - pointer to bmap descriptor 2392 * blkno - the first block of a block range within a dmap. it is 2393 * the allocation or deallocation of this block range that 2394 * requires the dmap control page to be adjusted. 2395 * newval - the new value of the lower level dmap or dmap control 2396 * page root. |
2397 * alloc - TRUE if adjustment is due to an allocation. | 2397 * alloc - 'true' if adjustment is due to an allocation. |
2398 * level - current level of dmap control page (i.e. L0, L1, L2) to 2399 * be adjusted. 2400 * 2401 * RETURN VALUES: 2402 * 0 - success 2403 * -EIO - i/o error 2404 * 2405 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; --- 879 unchanged lines hidden (view full) --- 3285 * L2L1L0d0,...,dnL0d0,...,dnL0d0,...,dnL1L0d0,...,dnL0d0,...,dnL0d0,..dm 3286 * 3287 * <---old---><----------------------------extend-----------------------> 3288 */ 3289int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) 3290{ 3291 struct jfs_sb_info *sbi = JFS_SBI(ipbmap->i_sb); 3292 int nbperpage = sbi->nbperpage; | 2398 * level - current level of dmap control page (i.e. L0, L1, L2) to 2399 * be adjusted. 2400 * 2401 * RETURN VALUES: 2402 * 0 - success 2403 * -EIO - i/o error 2404 * 2405 * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; --- 879 unchanged lines hidden (view full) --- 3285 * L2L1L0d0,...,dnL0d0,...,dnL0d0,...,dnL1L0d0,...,dnL0d0,...,dnL0d0,..dm 3286 * 3287 * <---old---><----------------------------extend-----------------------> 3288 */ 3289int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) 3290{ 3291 struct jfs_sb_info *sbi = JFS_SBI(ipbmap->i_sb); 3292 int nbperpage = sbi->nbperpage; |
3293 int i, i0 = TRUE, j, j0 = TRUE, k, n; | 3293 int i, i0 = true, j, j0 = true, k, n; |
3294 s64 newsize; 3295 s64 p; 3296 struct metapage *mp, *l2mp, *l1mp = NULL, *l0mp = NULL; 3297 struct dmapctl *l2dcp, *l1dcp, *l0dcp; 3298 struct dmap *dp; 3299 s8 *l0leaf, *l1leaf, *l2leaf; 3300 struct bmap *bmp = sbi->bmap; 3301 int agno, l2agsize, oldl2agsize; --- 91 unchanged lines hidden (view full) --- 3393 if (l1mp == NULL) 3394 goto errout; 3395 l1dcp = (struct dmapctl *) l1mp->data; 3396 3397 /* compute start L0 */ 3398 j = (blkno & (MAXL1SIZE - 1)) >> L2MAXL0SIZE; 3399 l1leaf = l1dcp->stree + CTLLEAFIND + j; 3400 p = BLKTOL0(blkno, sbi->l2nbperpage); | 3294 s64 newsize; 3295 s64 p; 3296 struct metapage *mp, *l2mp, *l1mp = NULL, *l0mp = NULL; 3297 struct dmapctl *l2dcp, *l1dcp, *l0dcp; 3298 struct dmap *dp; 3299 s8 *l0leaf, *l1leaf, *l2leaf; 3300 struct bmap *bmp = sbi->bmap; 3301 int agno, l2agsize, oldl2agsize; --- 91 unchanged lines hidden (view full) --- 3393 if (l1mp == NULL) 3394 goto errout; 3395 l1dcp = (struct dmapctl *) l1mp->data; 3396 3397 /* compute start L0 */ 3398 j = (blkno & (MAXL1SIZE - 1)) >> L2MAXL0SIZE; 3399 l1leaf = l1dcp->stree + CTLLEAFIND + j; 3400 p = BLKTOL0(blkno, sbi->l2nbperpage); |
3401 j0 = FALSE; | 3401 j0 = false; |
3402 } else { 3403 /* assign/init L1 page */ 3404 l1mp = get_metapage(ipbmap, p, PSIZE, 0); 3405 if (l1mp == NULL) 3406 goto errout; 3407 3408 l1dcp = (struct dmapctl *) l1mp->data; 3409 --- 17 unchanged lines hidden (view full) --- 3427 l0dcp = (struct dmapctl *) l0mp->data; 3428 3429 /* compute start dmap */ 3430 i = (blkno & (MAXL0SIZE - 1)) >> 3431 L2BPERDMAP; 3432 l0leaf = l0dcp->stree + CTLLEAFIND + i; 3433 p = BLKTODMAP(blkno, 3434 sbi->l2nbperpage); | 3402 } else { 3403 /* assign/init L1 page */ 3404 l1mp = get_metapage(ipbmap, p, PSIZE, 0); 3405 if (l1mp == NULL) 3406 goto errout; 3407 3408 l1dcp = (struct dmapctl *) l1mp->data; 3409 --- 17 unchanged lines hidden (view full) --- 3427 l0dcp = (struct dmapctl *) l0mp->data; 3428 3429 /* compute start dmap */ 3430 i = (blkno & (MAXL0SIZE - 1)) >> 3431 L2BPERDMAP; 3432 l0leaf = l0dcp->stree + CTLLEAFIND + i; 3433 p = BLKTODMAP(blkno, 3434 sbi->l2nbperpage); |
3435 i0 = FALSE; | 3435 i0 = false; |
3436 } else { 3437 /* assign/init L0 page */ 3438 l0mp = get_metapage(ipbmap, p, PSIZE, 0); 3439 if (l0mp == NULL) 3440 goto errout; 3441 3442 l0dcp = (struct dmapctl *) l0mp->data; 3443 --- 556 unchanged lines hidden --- | 3436 } else { 3437 /* assign/init L0 page */ 3438 l0mp = get_metapage(ipbmap, p, PSIZE, 0); 3439 if (l0mp == NULL) 3440 goto errout; 3441 3442 l0dcp = (struct dmapctl *) l0mp->data; 3443 --- 556 unchanged lines hidden --- |