aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_imap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/jfs_imap.c')
-rw-r--r--fs/jfs/jfs_imap.c222
1 files changed, 111 insertions, 111 deletions
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index a45ee2489580..489a3d63002d 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -3,16 +3,16 @@
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 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 6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details. 12 * the GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
@@ -98,7 +98,7 @@ static void copy_to_dinode(struct dinode *, struct inode *);
98 * FUNCTION: initialize the incore inode map control structures for 98 * FUNCTION: initialize the incore inode map control structures for
99 * a fileset or aggregate init time. 99 * a fileset or aggregate init time.
100 * 100 *
101 * the inode map's control structure (dinomap) is 101 * the inode map's control structure (dinomap) is
102 * brought in from disk and placed in virtual memory. 102 * brought in from disk and placed in virtual memory.
103 * 103 *
104 * PARAMETERS: 104 * PARAMETERS:
@@ -107,7 +107,7 @@ static void copy_to_dinode(struct dinode *, struct inode *);
107 * RETURN VALUES: 107 * RETURN VALUES:
108 * 0 - success 108 * 0 - success
109 * -ENOMEM - insufficient free virtual memory. 109 * -ENOMEM - insufficient free virtual memory.
110 * -EIO - i/o error. 110 * -EIO - i/o error.
111 */ 111 */
112int diMount(struct inode *ipimap) 112int diMount(struct inode *ipimap)
113{ 113{
@@ -191,7 +191,7 @@ int diMount(struct inode *ipimap)
191 * RETURN VALUES: 191 * RETURN VALUES:
192 * 0 - success 192 * 0 - success
193 * -ENOMEM - insufficient free virtual memory. 193 * -ENOMEM - insufficient free virtual memory.
194 * -EIO - i/o error. 194 * -EIO - i/o error.
195 */ 195 */
196int diUnmount(struct inode *ipimap, int mounterror) 196int diUnmount(struct inode *ipimap, int mounterror)
197{ 197{
@@ -281,7 +281,7 @@ int diSync(struct inode *ipimap)
281 * on entry, the specifed incore inode should itself 281 * on entry, the specifed incore inode should itself
282 * specify the disk inode number corresponding to the 282 * specify the disk inode number corresponding to the
283 * incore inode (i.e. i_number should be initialized). 283 * incore inode (i.e. i_number should be initialized).
284 * 284 *
285 * this routine handles incore inode initialization for 285 * this routine handles incore inode initialization for
286 * both "special" and "regular" inodes. special inodes 286 * both "special" and "regular" inodes. special inodes
287 * are those required early in the mount process and 287 * are those required early in the mount process and
@@ -289,7 +289,7 @@ int diSync(struct inode *ipimap)
289 * is not yet initialized. these "special" inodes are 289 * is not yet initialized. these "special" inodes are
290 * identified by a NULL inode map inode pointer and are 290 * identified by a NULL inode map inode pointer and are
291 * actually initialized by a call to diReadSpecial(). 291 * actually initialized by a call to diReadSpecial().
292 * 292 *
293 * for regular inodes, the iag describing the disk inode 293 * for regular inodes, the iag describing the disk inode
294 * is read from disk to determine the inode extent address 294 * is read from disk to determine the inode extent address
295 * for the disk inode. with the inode extent address in 295 * for the disk inode. with the inode extent address in
@@ -302,9 +302,9 @@ int diSync(struct inode *ipimap)
302 * 302 *
303 * RETURN VALUES: 303 * RETURN VALUES:
304 * 0 - success 304 * 0 - success
305 * -EIO - i/o error. 305 * -EIO - i/o error.
306 * -ENOMEM - insufficient memory 306 * -ENOMEM - insufficient memory
307 * 307 *
308 */ 308 */
309int diRead(struct inode *ip) 309int diRead(struct inode *ip)
310{ 310{
@@ -586,14 +586,14 @@ void diFreeSpecial(struct inode *ip)
586 * page of the extent that contains the disk inode is 586 * page of the extent that contains the disk inode is
587 * read and the disk inode portion of the incore inode 587 * read and the disk inode portion of the incore inode
588 * is copied to the disk inode. 588 * is copied to the disk inode.
589 * 589 *
590 * PARAMETERS: 590 * PARAMETERS:
591 * tid - transacation id 591 * tid - transacation id
592 * ip - pointer to incore inode to be written to the inode extent. 592 * ip - pointer to incore inode to be written to the inode extent.
593 * 593 *
594 * RETURN VALUES: 594 * RETURN VALUES:
595 * 0 - success 595 * 0 - success
596 * -EIO - i/o error. 596 * -EIO - i/o error.
597 */ 597 */
598int diWrite(tid_t tid, struct inode *ip) 598int diWrite(tid_t tid, struct inode *ip)
599{ 599{
@@ -676,11 +676,11 @@ int diWrite(tid_t tid, struct inode *ip)
676 * copy btree root from in-memory inode to on-disk inode 676 * copy btree root from in-memory inode to on-disk inode
677 * 677 *
678 * (tlock is taken from inline B+-tree root in in-memory 678 * (tlock is taken from inline B+-tree root in in-memory
679 * inode when the B+-tree root is updated, which is pointed 679 * inode when the B+-tree root is updated, which is pointed
680 * by jfs_ip->blid as well as being on tx tlock list) 680 * by jfs_ip->blid as well as being on tx tlock list)
681 * 681 *
682 * further processing of btree root is based on the copy 682 * further processing of btree root is based on the copy
683 * in in-memory inode, where txLog() will log from, and, 683 * in in-memory inode, where txLog() will log from, and,
684 * for xtree root, txUpdateMap() will update map and reset 684 * for xtree root, txUpdateMap() will update map and reset
685 * XAD_NEW bit; 685 * XAD_NEW bit;
686 */ 686 */
@@ -824,7 +824,7 @@ int diWrite(tid_t tid, struct inode *ip)
824 memcpy(&dp->di_DASD, &ip->i_DASD, sizeof(struct dasd)); 824 memcpy(&dp->di_DASD, &ip->i_DASD, sizeof(struct dasd));
825#endif /* _JFS_FASTDASD */ 825#endif /* _JFS_FASTDASD */
826 826
827 /* release the buffer holding the updated on-disk inode. 827 /* release the buffer holding the updated on-disk inode.
828 * the buffer will be later written by commit processing. 828 * the buffer will be later written by commit processing.
829 */ 829 */
830 write_metapage(mp); 830 write_metapage(mp);
@@ -842,7 +842,7 @@ int diWrite(tid_t tid, struct inode *ip)
842 * if the inode to be freed represents the first (only) 842 * if the inode to be freed represents the first (only)
843 * free inode within the iag, the iag will be placed on 843 * free inode within the iag, the iag will be placed on
844 * the ag free inode list. 844 * the ag free inode list.
845 * 845 *
846 * freeing the inode will cause the inode extent to be 846 * freeing the inode will cause the inode extent to be
847 * freed if the inode is the only allocated inode within 847 * freed if the inode is the only allocated inode within
848 * the extent. in this case all the disk resource backing 848 * the extent. in this case all the disk resource backing
@@ -865,11 +865,11 @@ int diWrite(tid_t tid, struct inode *ip)
865 * any updates and are held until all updates are complete. 865 * any updates and are held until all updates are complete.
866 * 866 *
867 * PARAMETERS: 867 * PARAMETERS:
868 * ip - inode to be freed. 868 * ip - inode to be freed.
869 * 869 *
870 * RETURN VALUES: 870 * RETURN VALUES:
871 * 0 - success 871 * 0 - success
872 * -EIO - i/o error. 872 * -EIO - i/o error.
873 */ 873 */
874int diFree(struct inode *ip) 874int diFree(struct inode *ip)
875{ 875{
@@ -898,7 +898,7 @@ int diFree(struct inode *ip)
898 */ 898 */
899 iagno = INOTOIAG(inum); 899 iagno = INOTOIAG(inum);
900 900
901 /* make sure that the iag is contained within 901 /* make sure that the iag is contained within
902 * the map. 902 * the map.
903 */ 903 */
904 if (iagno >= imap->im_nextiag) { 904 if (iagno >= imap->im_nextiag) {
@@ -1013,7 +1013,7 @@ int diFree(struct inode *ip)
1013 1013
1014 /* update the free inode summary map for the extent if 1014 /* update the free inode summary map for the extent if
1015 * freeing the inode means the extent will now have free 1015 * freeing the inode means the extent will now have free
1016 * inodes (i.e., the inode being freed is the first free 1016 * inodes (i.e., the inode being freed is the first free
1017 * inode of extent), 1017 * inode of extent),
1018 */ 1018 */
1019 if (iagp->wmap[extno] == cpu_to_le32(ONES)) { 1019 if (iagp->wmap[extno] == cpu_to_le32(ONES)) {
@@ -1204,9 +1204,9 @@ int diFree(struct inode *ip)
1204 iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1); 1204 iagp->inofreefwd = iagp->inofreeback = cpu_to_le32(-1);
1205 } 1205 }
1206 1206
1207 /* update the inode extent address and working map 1207 /* update the inode extent address and working map
1208 * to reflect the free extent. 1208 * to reflect the free extent.
1209 * the permanent map should have been updated already 1209 * the permanent map should have been updated already
1210 * for the inode being freed. 1210 * for the inode being freed.
1211 */ 1211 */
1212 if (iagp->pmap[extno] != 0) { 1212 if (iagp->pmap[extno] != 0) {
@@ -1218,7 +1218,7 @@ int diFree(struct inode *ip)
1218 1218
1219 /* update the free extent and free inode summary maps 1219 /* update the free extent and free inode summary maps
1220 * to reflect the freed extent. 1220 * to reflect the freed extent.
1221 * the inode summary map is marked to indicate no inodes 1221 * the inode summary map is marked to indicate no inodes
1222 * available for the freed extent. 1222 * available for the freed extent.
1223 */ 1223 */
1224 sword = extno >> L2EXTSPERSUM; 1224 sword = extno >> L2EXTSPERSUM;
@@ -1255,17 +1255,17 @@ int diFree(struct inode *ip)
1255 * start transaction to update block allocation map 1255 * start transaction to update block allocation map
1256 * for the inode extent freed; 1256 * for the inode extent freed;
1257 * 1257 *
1258 * N.B. AG_LOCK is released and iag will be released below, and 1258 * N.B. AG_LOCK is released and iag will be released below, and
1259 * other thread may allocate inode from/reusing the ixad freed 1259 * other thread may allocate inode from/reusing the ixad freed
1260 * BUT with new/different backing inode extent from the extent 1260 * BUT with new/different backing inode extent from the extent
1261 * to be freed by the transaction; 1261 * to be freed by the transaction;
1262 */ 1262 */
1263 tid = txBegin(ipimap->i_sb, COMMIT_FORCE); 1263 tid = txBegin(ipimap->i_sb, COMMIT_FORCE);
1264 mutex_lock(&JFS_IP(ipimap)->commit_mutex); 1264 mutex_lock(&JFS_IP(ipimap)->commit_mutex);
1265 1265
1266 /* acquire tlock of the iag page of the freed ixad 1266 /* acquire tlock of the iag page of the freed ixad
1267 * to force the page NOHOMEOK (even though no data is 1267 * to force the page NOHOMEOK (even though no data is
1268 * logged from the iag page) until NOREDOPAGE|FREEXTENT log 1268 * logged from the iag page) until NOREDOPAGE|FREEXTENT log
1269 * for the free of the extent is committed; 1269 * for the free of the extent is committed;
1270 * write FREEXTENT|NOREDOPAGE log record 1270 * write FREEXTENT|NOREDOPAGE log record
1271 * N.B. linelock is overlaid as freed extent descriptor; 1271 * N.B. linelock is overlaid as freed extent descriptor;
@@ -1284,8 +1284,8 @@ int diFree(struct inode *ip)
1284 * logredo needs the IAG number and IAG extent index in order 1284 * logredo needs the IAG number and IAG extent index in order
1285 * to ensure that the IMap is consistent. The least disruptive 1285 * to ensure that the IMap is consistent. The least disruptive
1286 * way to pass these values through to the transaction manager 1286 * way to pass these values through to the transaction manager
1287 * is in the iplist array. 1287 * is in the iplist array.
1288 * 1288 *
1289 * It's not pretty, but it works. 1289 * It's not pretty, but it works.
1290 */ 1290 */
1291 iplist[1] = (struct inode *) (size_t)iagno; 1291 iplist[1] = (struct inode *) (size_t)iagno;
@@ -1340,18 +1340,18 @@ diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp)
1340/* 1340/*
1341 * NAME: diAlloc(pip,dir,ip) 1341 * NAME: diAlloc(pip,dir,ip)
1342 * 1342 *
1343 * FUNCTION: allocate a disk inode from the inode working map 1343 * FUNCTION: allocate a disk inode from the inode working map
1344 * for a fileset or aggregate. 1344 * for a fileset or aggregate.
1345 * 1345 *
1346 * PARAMETERS: 1346 * PARAMETERS:
1347 * pip - pointer to incore inode for the parent inode. 1347 * pip - pointer to incore inode for the parent inode.
1348 * dir - 'true' if the new disk inode is for a directory. 1348 * dir - 'true' if the new disk inode is for a directory.
1349 * ip - pointer to a new inode 1349 * ip - pointer to a new inode
1350 * 1350 *
1351 * RETURN VALUES: 1351 * RETURN VALUES:
1352 * 0 - success. 1352 * 0 - success.
1353 * -ENOSPC - insufficient disk resources. 1353 * -ENOSPC - insufficient disk resources.
1354 * -EIO - i/o error. 1354 * -EIO - i/o error.
1355 */ 1355 */
1356int diAlloc(struct inode *pip, bool dir, struct inode *ip) 1356int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1357{ 1357{
@@ -1372,7 +1372,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1372 JFS_IP(ip)->ipimap = ipimap; 1372 JFS_IP(ip)->ipimap = ipimap;
1373 JFS_IP(ip)->fileset = FILESYSTEM_I; 1373 JFS_IP(ip)->fileset = FILESYSTEM_I;
1374 1374
1375 /* for a directory, the allocation policy is to start 1375 /* for a directory, the allocation policy is to start
1376 * at the ag level using the preferred ag. 1376 * at the ag level using the preferred ag.
1377 */ 1377 */
1378 if (dir) { 1378 if (dir) {
@@ -1435,7 +1435,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1435 /* 1435 /*
1436 * try to allocate from the IAG 1436 * try to allocate from the IAG
1437 */ 1437 */
1438 /* check if the inode may be allocated from the iag 1438 /* check if the inode may be allocated from the iag
1439 * (i.e. the inode has free inodes or new extent can be added). 1439 * (i.e. the inode has free inodes or new extent can be added).
1440 */ 1440 */
1441 if (iagp->nfreeinos || addext) { 1441 if (iagp->nfreeinos || addext) {
@@ -1490,7 +1490,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1490 * hint or, if appropriate (i.e. addext is true), allocate 1490 * hint or, if appropriate (i.e. addext is true), allocate
1491 * an extent of free inodes at or following the extent 1491 * an extent of free inodes at or following the extent
1492 * containing the hint. 1492 * containing the hint.
1493 * 1493 *
1494 * the free inode and free extent summary maps are used 1494 * the free inode and free extent summary maps are used
1495 * here, so determine the starting summary map position 1495 * here, so determine the starting summary map position
1496 * and the number of words we'll have to examine. again, 1496 * and the number of words we'll have to examine. again,
@@ -1641,7 +1641,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1641 * inodes should be added for the allocation group, with 1641 * inodes should be added for the allocation group, with
1642 * the current request satisfied from this extent. if this 1642 * the current request satisfied from this extent. if this
1643 * is the case, an attempt will be made to do just that. if 1643 * is the case, an attempt will be made to do just that. if
1644 * this attempt fails or it has been determined that a new 1644 * this attempt fails or it has been determined that a new
1645 * extent should not be added, an attempt is made to satisfy 1645 * extent should not be added, an attempt is made to satisfy
1646 * the request by allocating an existing (backed) free inode 1646 * the request by allocating an existing (backed) free inode
1647 * from the allocation group. 1647 * from the allocation group.
@@ -1649,24 +1649,24 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
1649 * PRE CONDITION: Already have the AG lock for this AG. 1649 * PRE CONDITION: Already have the AG lock for this AG.
1650 * 1650 *
1651 * PARAMETERS: 1651 * PARAMETERS:
1652 * imap - pointer to inode map control structure. 1652 * imap - pointer to inode map control structure.
1653 * agno - allocation group to allocate from. 1653 * agno - allocation group to allocate from.
1654 * dir - 'true' if the new disk inode is for a directory. 1654 * dir - 'true' if the new disk inode is for a directory.
1655 * ip - pointer to the new inode to be filled in on successful return 1655 * ip - pointer to the new inode to be filled in on successful return
1656 * with the disk inode number allocated, its extent address 1656 * with the disk inode number allocated, its extent address
1657 * and the start of the ag. 1657 * and the start of the ag.
1658 * 1658 *
1659 * RETURN VALUES: 1659 * RETURN VALUES:
1660 * 0 - success. 1660 * 0 - success.
1661 * -ENOSPC - insufficient disk resources. 1661 * -ENOSPC - insufficient disk resources.
1662 * -EIO - i/o error. 1662 * -EIO - i/o error.
1663 */ 1663 */
1664static int 1664static int
1665diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip) 1665diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip)
1666{ 1666{
1667 int rc, addext, numfree, numinos; 1667 int rc, addext, numfree, numinos;
1668 1668
1669 /* get the number of free and the number of backed disk 1669 /* get the number of free and the number of backed disk
1670 * inodes currently within the ag. 1670 * inodes currently within the ag.
1671 */ 1671 */
1672 numfree = imap->im_agctl[agno].numfree; 1672 numfree = imap->im_agctl[agno].numfree;
@@ -1719,17 +1719,17 @@ diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip)
1719 * specified primary group. 1719 * specified primary group.
1720 * 1720 *
1721 * PARAMETERS: 1721 * PARAMETERS:
1722 * imap - pointer to inode map control structure. 1722 * imap - pointer to inode map control structure.
1723 * agno - primary allocation group (to avoid). 1723 * agno - primary allocation group (to avoid).
1724 * dir - 'true' if the new disk inode is for a directory. 1724 * dir - 'true' if the new disk inode is for a directory.
1725 * ip - pointer to a new inode to be filled in on successful return 1725 * ip - pointer to a new inode to be filled in on successful return
1726 * with the disk inode number allocated, its extent address 1726 * with the disk inode number allocated, its extent address
1727 * and the start of the ag. 1727 * and the start of the ag.
1728 * 1728 *
1729 * RETURN VALUES: 1729 * RETURN VALUES:
1730 * 0 - success. 1730 * 0 - success.
1731 * -ENOSPC - insufficient disk resources. 1731 * -ENOSPC - insufficient disk resources.
1732 * -EIO - i/o error. 1732 * -EIO - i/o error.
1733 */ 1733 */
1734static int 1734static int
1735diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip) 1735diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip)
@@ -1738,7 +1738,7 @@ diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip)
1738 int maxag = JFS_SBI(imap->im_ipimap->i_sb)->bmap->db_maxag; 1738 int maxag = JFS_SBI(imap->im_ipimap->i_sb)->bmap->db_maxag;
1739 1739
1740 1740
1741 /* try to allocate from the ags following agno up to 1741 /* try to allocate from the ags following agno up to
1742 * the maximum ag number. 1742 * the maximum ag number.
1743 */ 1743 */
1744 for (ag = agno + 1; ag <= maxag; ag++) { 1744 for (ag = agno + 1; ag <= maxag; ag++) {
@@ -1780,21 +1780,21 @@ diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip)
1780 * 1780 *
1781 * allocation occurs from the first iag on the list using 1781 * allocation occurs from the first iag on the list using
1782 * the iag's free inode summary map to find the leftmost 1782 * the iag's free inode summary map to find the leftmost
1783 * free inode in the iag. 1783 * free inode in the iag.
1784 * 1784 *
1785 * PRE CONDITION: Already have AG lock for this AG. 1785 * PRE CONDITION: Already have AG lock for this AG.
1786 * 1786 *
1787 * PARAMETERS: 1787 * PARAMETERS:
1788 * imap - pointer to inode map control structure. 1788 * imap - pointer to inode map control structure.
1789 * agno - allocation group. 1789 * agno - allocation group.
1790 * ip - pointer to new inode to be filled in on successful return 1790 * ip - pointer to new inode to be filled in on successful return
1791 * with the disk inode number allocated, its extent address 1791 * with the disk inode number allocated, its extent address
1792 * and the start of the ag. 1792 * and the start of the ag.
1793 * 1793 *
1794 * RETURN VALUES: 1794 * RETURN VALUES:
1795 * 0 - success. 1795 * 0 - success.
1796 * -ENOSPC - insufficient disk resources. 1796 * -ENOSPC - insufficient disk resources.
1797 * -EIO - i/o error. 1797 * -EIO - i/o error.
1798 */ 1798 */
1799static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) 1799static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
1800{ 1800{
@@ -1867,7 +1867,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
1867 return -EIO; 1867 return -EIO;
1868 } 1868 }
1869 1869
1870 /* compute the inode number within the iag. 1870 /* compute the inode number within the iag.
1871 */ 1871 */
1872 ino = (extno << L2INOSPEREXT) + rem; 1872 ino = (extno << L2INOSPEREXT) + rem;
1873 1873
@@ -1892,17 +1892,17 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
1892/* 1892/*
1893 * NAME: diAllocExt(imap,agno,ip) 1893 * NAME: diAllocExt(imap,agno,ip)
1894 * 1894 *
1895 * FUNCTION: add a new extent of free inodes to an iag, allocating 1895 * FUNCTION: add a new extent of free inodes to an iag, allocating
1896 * an inode from this extent to satisfy the current allocation 1896 * an inode from this extent to satisfy the current allocation
1897 * request. 1897 * request.
1898 * 1898 *
1899 * this routine first tries to find an existing iag with free 1899 * this routine first tries to find an existing iag with free
1900 * extents through the ag free extent list. if list is not 1900 * extents through the ag free extent list. if list is not
1901 * empty, the head of the list will be selected as the home 1901 * empty, the head of the list will be selected as the home
1902 * of the new extent of free inodes. otherwise (the list is 1902 * of the new extent of free inodes. otherwise (the list is
1903 * empty), a new iag will be allocated for the ag to contain 1903 * empty), a new iag will be allocated for the ag to contain
1904 * the extent. 1904 * the extent.
1905 * 1905 *
1906 * once an iag has been selected, the free extent summary map 1906 * once an iag has been selected, the free extent summary map
1907 * is used to locate a free extent within the iag and diNewExt() 1907 * is used to locate a free extent within the iag and diNewExt()
1908 * is called to initialize the extent, with initialization 1908 * is called to initialize the extent, with initialization
@@ -1910,16 +1910,16 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip)
1910 * for the purpose of satisfying this request. 1910 * for the purpose of satisfying this request.
1911 * 1911 *
1912 * PARAMETERS: 1912 * PARAMETERS:
1913 * imap - pointer to inode map control structure. 1913 * imap - pointer to inode map control structure.
1914 * agno - allocation group number. 1914 * agno - allocation group number.
1915 * ip - pointer to new inode to be filled in on successful return 1915 * ip - pointer to new inode to be filled in on successful return
1916 * with the disk inode number allocated, its extent address 1916 * with the disk inode number allocated, its extent address
1917 * and the start of the ag. 1917 * and the start of the ag.
1918 * 1918 *
1919 * RETURN VALUES: 1919 * RETURN VALUES:
1920 * 0 - success. 1920 * 0 - success.
1921 * -ENOSPC - insufficient disk resources. 1921 * -ENOSPC - insufficient disk resources.
1922 * -EIO - i/o error. 1922 * -EIO - i/o error.
1923 */ 1923 */
1924static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) 1924static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
1925{ 1925{
@@ -2012,7 +2012,7 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
2012/* 2012/*
2013 * NAME: diAllocBit(imap,iagp,ino) 2013 * NAME: diAllocBit(imap,iagp,ino)
2014 * 2014 *
2015 * FUNCTION: allocate a backed inode from an iag. 2015 * FUNCTION: allocate a backed inode from an iag.
2016 * 2016 *
2017 * this routine performs the mechanics of allocating a 2017 * this routine performs the mechanics of allocating a
2018 * specified inode from a backed extent. 2018 * specified inode from a backed extent.
@@ -2025,19 +2025,19 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip)
2025 * in the face of updates to multiple buffers. under this 2025 * in the face of updates to multiple buffers. under this
2026 * approach, all required buffers are obtained before making 2026 * approach, all required buffers are obtained before making
2027 * any updates and are held all are updates are complete. 2027 * any updates and are held all are updates are complete.
2028 * 2028 *
2029 * PRE CONDITION: Already have buffer lock on iagp. Already have AG lock on 2029 * PRE CONDITION: Already have buffer lock on iagp. Already have AG lock on
2030 * this AG. Must have read lock on imap inode. 2030 * this AG. Must have read lock on imap inode.
2031 * 2031 *
2032 * PARAMETERS: 2032 * PARAMETERS:
2033 * imap - pointer to inode map control structure. 2033 * imap - pointer to inode map control structure.
2034 * iagp - pointer to iag. 2034 * iagp - pointer to iag.
2035 * ino - inode number to be allocated within the iag. 2035 * ino - inode number to be allocated within the iag.
2036 * 2036 *
2037 * RETURN VALUES: 2037 * RETURN VALUES:
2038 * 0 - success. 2038 * 0 - success.
2039 * -ENOSPC - insufficient disk resources. 2039 * -ENOSPC - insufficient disk resources.
2040 * -EIO - i/o error. 2040 * -EIO - i/o error.
2041 */ 2041 */
2042static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) 2042static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
2043{ 2043{
@@ -2172,19 +2172,19 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino)
2172 * buffers. under this approach, all required buffers are 2172 * buffers. under this approach, all required buffers are
2173 * obtained before making any updates and are held until all 2173 * obtained before making any updates and are held until all
2174 * updates are complete. 2174 * updates are complete.
2175 * 2175 *
2176 * PRE CONDITION: Already have buffer lock on iagp. Already have AG lock on 2176 * PRE CONDITION: Already have buffer lock on iagp. Already have AG lock on
2177 * this AG. Must have read lock on imap inode. 2177 * this AG. Must have read lock on imap inode.
2178 * 2178 *
2179 * PARAMETERS: 2179 * PARAMETERS:
2180 * imap - pointer to inode map control structure. 2180 * imap - pointer to inode map control structure.
2181 * iagp - pointer to iag. 2181 * iagp - pointer to iag.
2182 * extno - extent number. 2182 * extno - extent number.
2183 * 2183 *
2184 * RETURN VALUES: 2184 * RETURN VALUES:
2185 * 0 - success. 2185 * 0 - success.
2186 * -ENOSPC - insufficient disk resources. 2186 * -ENOSPC - insufficient disk resources.
2187 * -EIO - i/o error. 2187 * -EIO - i/o error.
2188 */ 2188 */
2189static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) 2189static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
2190{ 2190{
@@ -2432,34 +2432,34 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
2432/* 2432/*
2433 * NAME: diNewIAG(imap,iagnop,agno) 2433 * NAME: diNewIAG(imap,iagnop,agno)
2434 * 2434 *
2435 * FUNCTION: allocate a new iag for an allocation group. 2435 * FUNCTION: allocate a new iag for an allocation group.
2436 * 2436 *
2437 * first tries to allocate the iag from the inode map 2437 * first tries to allocate the iag from the inode map
2438 * iagfree list: 2438 * iagfree list:
2439 * if the list has free iags, the head of the list is removed 2439 * if the list has free iags, the head of the list is removed
2440 * and returned to satisfy the request. 2440 * and returned to satisfy the request.
2441 * if the inode map's iag free list is empty, the inode map 2441 * if the inode map's iag free list is empty, the inode map
2442 * is extended to hold a new iag. this new iag is initialized 2442 * is extended to hold a new iag. this new iag is initialized
2443 * and returned to satisfy the request. 2443 * and returned to satisfy the request.
2444 * 2444 *
2445 * PARAMETERS: 2445 * PARAMETERS:
2446 * imap - pointer to inode map control structure. 2446 * imap - pointer to inode map control structure.
2447 * iagnop - pointer to an iag number set with the number of the 2447 * iagnop - pointer to an iag number set with the number of the
2448 * newly allocated iag upon successful return. 2448 * newly allocated iag upon successful return.
2449 * agno - allocation group number. 2449 * agno - allocation group number.
2450 * bpp - Buffer pointer to be filled in with new IAG's buffer 2450 * bpp - Buffer pointer to be filled in with new IAG's buffer
2451 * 2451 *
2452 * RETURN VALUES: 2452 * RETURN VALUES:
2453 * 0 - success. 2453 * 0 - success.
2454 * -ENOSPC - insufficient disk resources. 2454 * -ENOSPC - insufficient disk resources.
2455 * -EIO - i/o error. 2455 * -EIO - i/o error.
2456 * 2456 *
2457 * serialization: 2457 * serialization:
2458 * AG lock held on entry/exit; 2458 * AG lock held on entry/exit;
2459 * write lock on the map is held inside; 2459 * write lock on the map is held inside;
2460 * read lock on the map is held on successful completion; 2460 * read lock on the map is held on successful completion;
2461 * 2461 *
2462 * note: new iag transaction: 2462 * note: new iag transaction:
2463 * . synchronously write iag; 2463 * . synchronously write iag;
2464 * . write log of xtree and inode of imap; 2464 * . write log of xtree and inode of imap;
2465 * . commit; 2465 * . commit;
@@ -2494,7 +2494,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2494 /* acquire the free iag lock */ 2494 /* acquire the free iag lock */
2495 IAGFREE_LOCK(imap); 2495 IAGFREE_LOCK(imap);
2496 2496
2497 /* if there are any iags on the inode map free iag list, 2497 /* if there are any iags on the inode map free iag list,
2498 * allocate the iag from the head of the list. 2498 * allocate the iag from the head of the list.
2499 */ 2499 */
2500 if (imap->im_freeiag >= 0) { 2500 if (imap->im_freeiag >= 0) {
@@ -2618,8 +2618,8 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2618 flush_metapage(mp); 2618 flush_metapage(mp);
2619 2619
2620 /* 2620 /*
2621 * txCommit(COMMIT_FORCE) will synchronously write address 2621 * txCommit(COMMIT_FORCE) will synchronously write address
2622 * index pages and inode after commit in careful update order 2622 * index pages and inode after commit in careful update order
2623 * of address index pages (right to left, bottom up); 2623 * of address index pages (right to left, bottom up);
2624 */ 2624 */
2625 iplist[0] = ipimap; 2625 iplist[0] = ipimap;
@@ -2678,11 +2678,11 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2678 * 2678 *
2679 * FUNCTION: get the buffer for the specified iag within a fileset 2679 * FUNCTION: get the buffer for the specified iag within a fileset
2680 * or aggregate inode map. 2680 * or aggregate inode map.
2681 * 2681 *
2682 * PARAMETERS: 2682 * PARAMETERS:
2683 * imap - pointer to inode map control structure. 2683 * imap - pointer to inode map control structure.
2684 * iagno - iag number. 2684 * iagno - iag number.
2685 * bpp - point to buffer pointer to be filled in on successful 2685 * bpp - point to buffer pointer to be filled in on successful
2686 * exit. 2686 * exit.
2687 * 2687 *
2688 * SERIALIZATION: 2688 * SERIALIZATION:
@@ -2692,7 +2692,7 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp)
2692 * 2692 *
2693 * RETURN VALUES: 2693 * RETURN VALUES:
2694 * 0 - success. 2694 * 0 - success.
2695 * -EIO - i/o error. 2695 * -EIO - i/o error.
2696 */ 2696 */
2697static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) 2697static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
2698{ 2698{
@@ -2718,8 +2718,8 @@ static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp)
2718 * the specified bit position. 2718 * the specified bit position.
2719 * 2719 *
2720 * PARAMETERS: 2720 * PARAMETERS:
2721 * word - word to be examined. 2721 * word - word to be examined.
2722 * start - starting bit position. 2722 * start - starting bit position.
2723 * 2723 *
2724 * RETURN VALUES: 2724 * RETURN VALUES:
2725 * bit position of first free bit in the word or 32 if 2725 * bit position of first free bit in the word or 32 if
@@ -2740,10 +2740,10 @@ static int diFindFree(u32 word, int start)
2740 2740
2741/* 2741/*
2742 * NAME: diUpdatePMap() 2742 * NAME: diUpdatePMap()
2743 * 2743 *
2744 * FUNCTION: Update the persistent map in an IAG for the allocation or 2744 * FUNCTION: Update the persistent map in an IAG for the allocation or
2745 * freeing of the specified inode. 2745 * freeing of the specified inode.
2746 * 2746 *
2747 * PRE CONDITIONS: Working map has already been updated for allocate. 2747 * PRE CONDITIONS: Working map has already been updated for allocate.
2748 * 2748 *
2749 * PARAMETERS: 2749 * PARAMETERS:
@@ -2752,7 +2752,7 @@ static int diFindFree(u32 word, int start)
2752 * is_free - If 'true' indicates inode should be marked freed, otherwise 2752 * is_free - If 'true' indicates inode should be marked freed, otherwise
2753 * indicates inode should be marked allocated. 2753 * indicates inode should be marked allocated.
2754 * 2754 *
2755 * RETURN VALUES: 2755 * RETURN VALUES:
2756 * 0 for success 2756 * 0 for success
2757 */ 2757 */
2758int 2758int
@@ -2793,7 +2793,7 @@ diUpdatePMap(struct inode *ipimap,
2793 extno = ino >> L2INOSPEREXT; 2793 extno = ino >> L2INOSPEREXT;
2794 bitno = ino & (INOSPEREXT - 1); 2794 bitno = ino & (INOSPEREXT - 1);
2795 mask = HIGHORDER >> bitno; 2795 mask = HIGHORDER >> bitno;
2796 /* 2796 /*
2797 * mark the inode free in persistent map: 2797 * mark the inode free in persistent map:
2798 */ 2798 */
2799 if (is_free) { 2799 if (is_free) {
@@ -2803,7 +2803,7 @@ diUpdatePMap(struct inode *ipimap,
2803 * of last reference release; 2803 * of last reference release;
2804 */ 2804 */
2805 if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) { 2805 if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {
2806 jfs_error(ipimap->i_sb, 2806 jfs_error(ipimap->i_sb,
2807 "diUpdatePMap: inode %ld not marked as " 2807 "diUpdatePMap: inode %ld not marked as "
2808 "allocated in wmap!", inum); 2808 "allocated in wmap!", inum);
2809 } 2809 }
@@ -2877,8 +2877,8 @@ diUpdatePMap(struct inode *ipimap,
2877 * diExtendFS() 2877 * diExtendFS()
2878 * 2878 *
2879 * function: update imap for extendfs(); 2879 * function: update imap for extendfs();
2880 * 2880 *
2881 * note: AG size has been increased s.t. each k old contiguous AGs are 2881 * note: AG size has been increased s.t. each k old contiguous AGs are
2882 * coalesced into a new AG; 2882 * coalesced into a new AG;
2883 */ 2883 */
2884int diExtendFS(struct inode *ipimap, struct inode *ipbmap) 2884int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
@@ -2897,7 +2897,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
2897 atomic_read(&imap->im_numfree)); 2897 atomic_read(&imap->im_numfree));
2898 2898
2899 /* 2899 /*
2900 * reconstruct imap 2900 * reconstruct imap
2901 * 2901 *
2902 * coalesce contiguous k (newAGSize/oldAGSize) AGs; 2902 * coalesce contiguous k (newAGSize/oldAGSize) AGs;
2903 * i.e., (AGi, ..., AGj) where i = k*n and j = k*(n+1) - 1 to AGn; 2903 * i.e., (AGi, ..., AGj) where i = k*n and j = k*(n+1) - 1 to AGn;
@@ -2931,7 +2931,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap)
2931 } 2931 }
2932 2932
2933 /* leave free iag in the free iag list */ 2933 /* leave free iag in the free iag list */
2934 if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG)) { 2934 if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG)) {
2935 release_metapage(bp); 2935 release_metapage(bp);
2936 continue; 2936 continue;
2937 } 2937 }