jfs_extent.c (185a257f2f73bcd89050ad02da5bedbc28fc43fa) | jfs_extent.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 * --- 60 unchanged lines hidden (view full) --- 69 * PARAMETERS: 70 * ip - the inode of the file. 71 * xlen - requested extent length. 72 * pno - the starting page number with the file. 73 * xp - pointer to an xad. on entry, xad describes an 74 * extent that is used as an allocation hint if the 75 * xaddr of the xad is non-zero. on successful exit, 76 * the xad describes the newly allocated extent. | 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 * --- 60 unchanged lines hidden (view full) --- 69 * PARAMETERS: 70 * ip - the inode of the file. 71 * xlen - requested extent length. 72 * pno - the starting page number with the file. 73 * xp - pointer to an xad. on entry, xad describes an 74 * extent that is used as an allocation hint if the 75 * xaddr of the xad is non-zero. on successful exit, 76 * the xad describes the newly allocated extent. |
77 * abnr - boolean_t indicating whether the newly allocated extent | 77 * abnr - bool indicating whether the newly allocated extent |
78 * should be marked as allocated but not recorded. 79 * 80 * RETURN VALUES: 81 * 0 - success 82 * -EIO - i/o error. 83 * -ENOSPC - insufficient disk resources. 84 */ 85int | 78 * should be marked as allocated but not recorded. 79 * 80 * RETURN VALUES: 81 * 0 - success 82 * -EIO - i/o error. 83 * -ENOSPC - insufficient disk resources. 84 */ 85int |
86extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr) | 86extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) |
87{ 88 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); 89 s64 nxlen, nxaddr, xoff, hint, xaddr = 0; 90 int rc; 91 int xflag; 92 93 /* This blocks if we are low on resources */ 94 txBeginAnon(ip->i_sb); --- 17 unchanged lines hidden (view full) --- 112 * immediately previous to the current allocation 113 * request and if hint extent has the same abnr 114 * value as the current request. if so, we can 115 * extend the hint extent to include the current 116 * extent if we can allocate the blocks immediately 117 * following the hint extent. 118 */ 119 if (offsetXAD(xp) + nxlen == xoff && | 87{ 88 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); 89 s64 nxlen, nxaddr, xoff, hint, xaddr = 0; 90 int rc; 91 int xflag; 92 93 /* This blocks if we are low on resources */ 94 txBeginAnon(ip->i_sb); --- 17 unchanged lines hidden (view full) --- 112 * immediately previous to the current allocation 113 * request and if hint extent has the same abnr 114 * value as the current request. if so, we can 115 * extend the hint extent to include the current 116 * extent if we can allocate the blocks immediately 117 * following the hint extent. 118 */ 119 if (offsetXAD(xp) + nxlen == xoff && |
120 abnr == ((xp->flag & XAD_NOTRECORDED) ? TRUE : FALSE)) | 120 abnr == ((xp->flag & XAD_NOTRECORDED) ? true : false)) |
121 xaddr = hint + nxlen; 122 123 /* adjust the hint to the last block of the extent */ 124 hint += (nxlen - 1); 125 } 126 127 /* allocate the disk blocks for the extent. initially, extBalloc() 128 * will try to allocate disk blocks for the requested size (xlen). --- 14 unchanged lines hidden (view full) --- 143 /* Allocate blocks to quota. */ 144 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { 145 dbFree(ip, nxaddr, (s64) nxlen); 146 mutex_unlock(&JFS_IP(ip)->commit_mutex); 147 return -EDQUOT; 148 } 149 150 /* determine the value of the extent flag */ | 121 xaddr = hint + nxlen; 122 123 /* adjust the hint to the last block of the extent */ 124 hint += (nxlen - 1); 125 } 126 127 /* allocate the disk blocks for the extent. initially, extBalloc() 128 * will try to allocate disk blocks for the requested size (xlen). --- 14 unchanged lines hidden (view full) --- 143 /* Allocate blocks to quota. */ 144 if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { 145 dbFree(ip, nxaddr, (s64) nxlen); 146 mutex_unlock(&JFS_IP(ip)->commit_mutex); 147 return -EDQUOT; 148 } 149 150 /* determine the value of the extent flag */ |
151 xflag = (abnr == TRUE) ? XAD_NOTRECORDED : 0; | 151 xflag = abnr ? XAD_NOTRECORDED : 0; |
152 153 /* if we can extend the hint extent to cover the current request, 154 * extend it. otherwise, insert a new extent to 155 * cover the current request. 156 */ 157 if (xaddr && xaddr == nxaddr) 158 rc = xtExtend(0, ip, xoff, (int) nxlen, 0); 159 else --- 38 unchanged lines hidden (view full) --- 198 * partial back last page. 199 * 200 * PARAMETERS: 201 * ip - the inode of the file. 202 * cp - cbuf for the partial backed last page. 203 * xlen - request size of the resulting extent. 204 * xp - pointer to an xad. on successful exit, the xad 205 * describes the newly allocated extent. | 152 153 /* if we can extend the hint extent to cover the current request, 154 * extend it. otherwise, insert a new extent to 155 * cover the current request. 156 */ 157 if (xaddr && xaddr == nxaddr) 158 rc = xtExtend(0, ip, xoff, (int) nxlen, 0); 159 else --- 38 unchanged lines hidden (view full) --- 198 * partial back last page. 199 * 200 * PARAMETERS: 201 * ip - the inode of the file. 202 * cp - cbuf for the partial backed last page. 203 * xlen - request size of the resulting extent. 204 * xp - pointer to an xad. on successful exit, the xad 205 * describes the newly allocated extent. |
206 * abnr - boolean_t indicating whether the newly allocated extent | 206 * abnr - bool indicating whether the newly allocated extent |
207 * should be marked as allocated but not recorded. 208 * 209 * RETURN VALUES: 210 * 0 - success 211 * -EIO - i/o error. 212 * -ENOSPC - insufficient disk resources. 213 */ | 207 * should be marked as allocated but not recorded. 208 * 209 * RETURN VALUES: 210 * 0 - success 211 * -EIO - i/o error. 212 * -ENOSPC - insufficient disk resources. 213 */ |
214int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr) | 214int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) |
215{ 216 struct super_block *sb = ip->i_sb; 217 s64 xaddr, xlen, nxaddr, delta, xoff; 218 s64 ntail, nextend, ninsert; 219 int rc, nbperpage = JFS_SBI(sb)->nbperpage; 220 int xflag; 221 222 /* This blocks if we are low on resources */ --- 248 unchanged lines hidden (view full) --- 471 s64 blkno = offsetXAD(xp) >> ip->i_blkbits; 472 473// assert(ISSPARSE(ip)); 474 475 /* initialize the extent allocation hint */ 476 XADaddress(xp, 0); 477 478 /* allocate an extent to fill the hole */ | 215{ 216 struct super_block *sb = ip->i_sb; 217 s64 xaddr, xlen, nxaddr, delta, xoff; 218 s64 ntail, nextend, ninsert; 219 int rc, nbperpage = JFS_SBI(sb)->nbperpage; 220 int xflag; 221 222 /* This blocks if we are low on resources */ --- 248 unchanged lines hidden (view full) --- 471 s64 blkno = offsetXAD(xp) >> ip->i_blkbits; 472 473// assert(ISSPARSE(ip)); 474 475 /* initialize the extent allocation hint */ 476 XADaddress(xp, 0); 477 478 /* allocate an extent to fill the hole */ |
479 if ((rc = extAlloc(ip, nbperpage, blkno, xp, FALSE))) | 479 if ((rc = extAlloc(ip, nbperpage, blkno, xp, false))) |
480 return (rc); 481 482 assert(lengthPXD(xp) == nbperpage); 483 484 return (0); 485} 486#endif /* _NOTYET */ 487 --- 176 unchanged lines hidden --- | 480 return (rc); 481 482 assert(lengthPXD(xp) == nbperpage); 483 484 return (0); 485} 486#endif /* _NOTYET */ 487 --- 176 unchanged lines hidden --- |