diff options
Diffstat (limited to 'fs/jfs/jfs_imap.c')
-rw-r--r-- | fs/jfs/jfs_imap.c | 293 |
1 files changed, 139 insertions, 154 deletions
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index c6530227cda6..f5c5227b0d1f 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -93,21 +93,21 @@ static int copy_from_dinode(struct dinode *, struct inode *); | |||
93 | static void copy_to_dinode(struct dinode *, struct inode *); | 93 | static void copy_to_dinode(struct dinode *, struct inode *); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * NAME: diMount() | 96 | * NAME: diMount() |
97 | * | 97 | * |
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: |
105 | * ipimap - pointer to inode map inode for the aggregate or fileset. | 105 | * ipimap - pointer to inode map inode for the aggregate or fileset. |
106 | * | 106 | * |
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 | */ |
112 | int diMount(struct inode *ipimap) | 112 | int diMount(struct inode *ipimap) |
113 | { | 113 | { |
@@ -180,18 +180,18 @@ int diMount(struct inode *ipimap) | |||
180 | 180 | ||
181 | 181 | ||
182 | /* | 182 | /* |
183 | * NAME: diUnmount() | 183 | * NAME: diUnmount() |
184 | * | 184 | * |
185 | * FUNCTION: write to disk the incore inode map control structures for | 185 | * FUNCTION: write to disk the incore inode map control structures for |
186 | * a fileset or aggregate at unmount time. | 186 | * a fileset or aggregate at unmount time. |
187 | * | 187 | * |
188 | * PARAMETERS: | 188 | * PARAMETERS: |
189 | * ipimap - pointer to inode map inode for the aggregate or fileset. | 189 | * ipimap - pointer to inode map inode for the aggregate or fileset. |
190 | * | 190 | * |
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 | */ |
196 | int diUnmount(struct inode *ipimap, int mounterror) | 196 | int diUnmount(struct inode *ipimap, int mounterror) |
197 | { | 197 | { |
@@ -274,9 +274,9 @@ int diSync(struct inode *ipimap) | |||
274 | 274 | ||
275 | 275 | ||
276 | /* | 276 | /* |
277 | * NAME: diRead() | 277 | * NAME: diRead() |
278 | * | 278 | * |
279 | * FUNCTION: initialize an incore inode from disk. | 279 | * FUNCTION: initialize an incore inode from disk. |
280 | * | 280 | * |
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 |
@@ -285,7 +285,7 @@ int diSync(struct inode *ipimap) | |||
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 |
288 | * require special handling since much of the file system | 288 | * require special handling since much of the file system |
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(). |
@@ -298,12 +298,12 @@ int diSync(struct inode *ipimap) | |||
298 | * incore inode. | 298 | * incore inode. |
299 | * | 299 | * |
300 | * PARAMETERS: | 300 | * PARAMETERS: |
301 | * ip - pointer to incore inode to be initialized from disk. | 301 | * ip - pointer to incore inode to be initialized from disk. |
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 | */ |
309 | int diRead(struct inode *ip) | 309 | int diRead(struct inode *ip) |
@@ -410,26 +410,26 @@ int diRead(struct inode *ip) | |||
410 | 410 | ||
411 | 411 | ||
412 | /* | 412 | /* |
413 | * NAME: diReadSpecial() | 413 | * NAME: diReadSpecial() |
414 | * | 414 | * |
415 | * FUNCTION: initialize a 'special' inode from disk. | 415 | * FUNCTION: initialize a 'special' inode from disk. |
416 | * | 416 | * |
417 | * this routines handles aggregate level inodes. The | 417 | * this routines handles aggregate level inodes. The |
418 | * inode cache cannot differentiate between the | 418 | * inode cache cannot differentiate between the |
419 | * aggregate inodes and the filesystem inodes, so we | 419 | * aggregate inodes and the filesystem inodes, so we |
420 | * handle these here. We don't actually use the aggregate | 420 | * handle these here. We don't actually use the aggregate |
421 | * inode map, since these inodes are at a fixed location | 421 | * inode map, since these inodes are at a fixed location |
422 | * and in some cases the aggregate inode map isn't initialized | 422 | * and in some cases the aggregate inode map isn't initialized |
423 | * yet. | 423 | * yet. |
424 | * | 424 | * |
425 | * PARAMETERS: | 425 | * PARAMETERS: |
426 | * sb - filesystem superblock | 426 | * sb - filesystem superblock |
427 | * inum - aggregate inode number | 427 | * inum - aggregate inode number |
428 | * secondary - 1 if secondary aggregate inode table | 428 | * secondary - 1 if secondary aggregate inode table |
429 | * | 429 | * |
430 | * RETURN VALUES: | 430 | * RETURN VALUES: |
431 | * new inode - success | 431 | * new inode - success |
432 | * NULL - i/o error. | 432 | * NULL - i/o error. |
433 | */ | 433 | */ |
434 | struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) | 434 | struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) |
435 | { | 435 | { |
@@ -502,12 +502,12 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) | |||
502 | } | 502 | } |
503 | 503 | ||
504 | /* | 504 | /* |
505 | * NAME: diWriteSpecial() | 505 | * NAME: diWriteSpecial() |
506 | * | 506 | * |
507 | * FUNCTION: Write the special inode to disk | 507 | * FUNCTION: Write the special inode to disk |
508 | * | 508 | * |
509 | * PARAMETERS: | 509 | * PARAMETERS: |
510 | * ip - special inode | 510 | * ip - special inode |
511 | * secondary - 1 if secondary aggregate inode table | 511 | * secondary - 1 if secondary aggregate inode table |
512 | * | 512 | * |
513 | * RETURN VALUES: none | 513 | * RETURN VALUES: none |
@@ -554,9 +554,9 @@ void diWriteSpecial(struct inode *ip, int secondary) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | /* | 556 | /* |
557 | * NAME: diFreeSpecial() | 557 | * NAME: diFreeSpecial() |
558 | * | 558 | * |
559 | * FUNCTION: Free allocated space for special inode | 559 | * FUNCTION: Free allocated space for special inode |
560 | */ | 560 | */ |
561 | void diFreeSpecial(struct inode *ip) | 561 | void diFreeSpecial(struct inode *ip) |
562 | { | 562 | { |
@@ -572,9 +572,9 @@ void diFreeSpecial(struct inode *ip) | |||
572 | 572 | ||
573 | 573 | ||
574 | /* | 574 | /* |
575 | * NAME: diWrite() | 575 | * NAME: diWrite() |
576 | * | 576 | * |
577 | * FUNCTION: write the on-disk inode portion of the in-memory inode | 577 | * FUNCTION: write the on-disk inode portion of the in-memory inode |
578 | * to its corresponding on-disk inode. | 578 | * to its corresponding on-disk inode. |
579 | * | 579 | * |
580 | * on entry, the specifed incore inode should itself | 580 | * on entry, the specifed incore inode should itself |
@@ -589,11 +589,11 @@ void diFreeSpecial(struct inode *ip) | |||
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 | */ |
598 | int diWrite(tid_t tid, struct inode *ip) | 598 | int diWrite(tid_t tid, struct inode *ip) |
599 | { | 599 | { |
@@ -730,7 +730,7 @@ int diWrite(tid_t tid, struct inode *ip) | |||
730 | ilinelock = (struct linelock *) & tlck->lock; | 730 | ilinelock = (struct linelock *) & tlck->lock; |
731 | 731 | ||
732 | /* | 732 | /* |
733 | * regular file: 16 byte (XAD slot) granularity | 733 | * regular file: 16 byte (XAD slot) granularity |
734 | */ | 734 | */ |
735 | if (type & tlckXTREE) { | 735 | if (type & tlckXTREE) { |
736 | xtpage_t *p, *xp; | 736 | xtpage_t *p, *xp; |
@@ -755,7 +755,7 @@ int diWrite(tid_t tid, struct inode *ip) | |||
755 | xad->flag &= ~(XAD_NEW | XAD_EXTENDED); | 755 | xad->flag &= ~(XAD_NEW | XAD_EXTENDED); |
756 | } | 756 | } |
757 | /* | 757 | /* |
758 | * directory: 32 byte (directory entry slot) granularity | 758 | * directory: 32 byte (directory entry slot) granularity |
759 | */ | 759 | */ |
760 | else if (type & tlckDTREE) { | 760 | else if (type & tlckDTREE) { |
761 | dtpage_t *p, *xp; | 761 | dtpage_t *p, *xp; |
@@ -800,9 +800,8 @@ int diWrite(tid_t tid, struct inode *ip) | |||
800 | } | 800 | } |
801 | 801 | ||
802 | /* | 802 | /* |
803 | * lock/copy inode base: 128 byte slot granularity | 803 | * lock/copy inode base: 128 byte slot granularity |
804 | */ | 804 | */ |
805 | // baseDinode: | ||
806 | lv = & dilinelock->lv[dilinelock->index]; | 805 | lv = & dilinelock->lv[dilinelock->index]; |
807 | lv->offset = dioffset >> L2INODESLOTSIZE; | 806 | lv->offset = dioffset >> L2INODESLOTSIZE; |
808 | copy_to_dinode(dp, ip); | 807 | copy_to_dinode(dp, ip); |
@@ -813,17 +812,6 @@ int diWrite(tid_t tid, struct inode *ip) | |||
813 | lv->length = 1; | 812 | lv->length = 1; |
814 | dilinelock->index++; | 813 | dilinelock->index++; |
815 | 814 | ||
816 | #ifdef _JFS_FASTDASD | ||
817 | /* | ||
818 | * We aren't logging changes to the DASD used in directory inodes, | ||
819 | * but we need to write them to disk. If we don't unmount cleanly, | ||
820 | * mount will recalculate the DASD used. | ||
821 | */ | ||
822 | if (S_ISDIR(ip->i_mode) | ||
823 | && (ip->i_ipmnt->i_mntflag & JFS_DASD_ENABLED)) | ||
824 | memcpy(&dp->di_DASD, &ip->i_DASD, sizeof(struct dasd)); | ||
825 | #endif /* _JFS_FASTDASD */ | ||
826 | |||
827 | /* release the buffer holding the updated on-disk inode. | 815 | /* release the buffer holding the updated on-disk inode. |
828 | * the buffer will be later written by commit processing. | 816 | * the buffer will be later written by commit processing. |
829 | */ | 817 | */ |
@@ -834,9 +822,9 @@ int diWrite(tid_t tid, struct inode *ip) | |||
834 | 822 | ||
835 | 823 | ||
836 | /* | 824 | /* |
837 | * NAME: diFree(ip) | 825 | * NAME: diFree(ip) |
838 | * | 826 | * |
839 | * FUNCTION: free a specified inode from the inode working map | 827 | * FUNCTION: free a specified inode from the inode working map |
840 | * for a fileset or aggregate. | 828 | * for a fileset or aggregate. |
841 | * | 829 | * |
842 | * if the inode to be freed represents the first (only) | 830 | * if the inode to be freed represents the first (only) |
@@ -865,11 +853,11 @@ int diWrite(tid_t tid, struct inode *ip) | |||
865 | * any updates and are held until all updates are complete. | 853 | * any updates and are held until all updates are complete. |
866 | * | 854 | * |
867 | * PARAMETERS: | 855 | * PARAMETERS: |
868 | * ip - inode to be freed. | 856 | * ip - inode to be freed. |
869 | * | 857 | * |
870 | * RETURN VALUES: | 858 | * RETURN VALUES: |
871 | * 0 - success | 859 | * 0 - success |
872 | * -EIO - i/o error. | 860 | * -EIO - i/o error. |
873 | */ | 861 | */ |
874 | int diFree(struct inode *ip) | 862 | int diFree(struct inode *ip) |
875 | { | 863 | { |
@@ -964,8 +952,8 @@ int diFree(struct inode *ip) | |||
964 | return -EIO; | 952 | return -EIO; |
965 | } | 953 | } |
966 | /* | 954 | /* |
967 | * inode extent still has some inodes or below low water mark: | 955 | * inode extent still has some inodes or below low water mark: |
968 | * keep the inode extent; | 956 | * keep the inode extent; |
969 | */ | 957 | */ |
970 | if (bitmap || | 958 | if (bitmap || |
971 | imap->im_agctl[agno].numfree < 96 || | 959 | imap->im_agctl[agno].numfree < 96 || |
@@ -1047,12 +1035,12 @@ int diFree(struct inode *ip) | |||
1047 | 1035 | ||
1048 | 1036 | ||
1049 | /* | 1037 | /* |
1050 | * inode extent has become free and above low water mark: | 1038 | * inode extent has become free and above low water mark: |
1051 | * free the inode extent; | 1039 | * free the inode extent; |
1052 | */ | 1040 | */ |
1053 | 1041 | ||
1054 | /* | 1042 | /* |
1055 | * prepare to update iag list(s) (careful update step 1) | 1043 | * prepare to update iag list(s) (careful update step 1) |
1056 | */ | 1044 | */ |
1057 | amp = bmp = cmp = dmp = NULL; | 1045 | amp = bmp = cmp = dmp = NULL; |
1058 | fwd = back = -1; | 1046 | fwd = back = -1; |
@@ -1152,7 +1140,7 @@ int diFree(struct inode *ip) | |||
1152 | invalidate_pxd_metapages(ip, freepxd); | 1140 | invalidate_pxd_metapages(ip, freepxd); |
1153 | 1141 | ||
1154 | /* | 1142 | /* |
1155 | * update iag list(s) (careful update step 2) | 1143 | * update iag list(s) (careful update step 2) |
1156 | */ | 1144 | */ |
1157 | /* add the iag to the ag extent free list if this is the | 1145 | /* add the iag to the ag extent free list if this is the |
1158 | * first free extent for the iag. | 1146 | * first free extent for the iag. |
@@ -1338,20 +1326,20 @@ diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) | |||
1338 | 1326 | ||
1339 | 1327 | ||
1340 | /* | 1328 | /* |
1341 | * NAME: diAlloc(pip,dir,ip) | 1329 | * NAME: diAlloc(pip,dir,ip) |
1342 | * | 1330 | * |
1343 | * FUNCTION: allocate a disk inode from the inode working map | 1331 | * FUNCTION: allocate a disk inode from the inode working map |
1344 | * for a fileset or aggregate. | 1332 | * for a fileset or aggregate. |
1345 | * | 1333 | * |
1346 | * PARAMETERS: | 1334 | * PARAMETERS: |
1347 | * pip - pointer to incore inode for the parent inode. | 1335 | * pip - pointer to incore inode for the parent inode. |
1348 | * dir - 'true' if the new disk inode is for a directory. | 1336 | * dir - 'true' if the new disk inode is for a directory. |
1349 | * ip - pointer to a new inode | 1337 | * ip - pointer to a new inode |
1350 | * | 1338 | * |
1351 | * RETURN VALUES: | 1339 | * RETURN VALUES: |
1352 | * 0 - success. | 1340 | * 0 - success. |
1353 | * -ENOSPC - insufficient disk resources. | 1341 | * -ENOSPC - insufficient disk resources. |
1354 | * -EIO - i/o error. | 1342 | * -EIO - i/o error. |
1355 | */ | 1343 | */ |
1356 | int diAlloc(struct inode *pip, bool dir, struct inode *ip) | 1344 | int diAlloc(struct inode *pip, bool dir, struct inode *ip) |
1357 | { | 1345 | { |
@@ -1433,7 +1421,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) | |||
1433 | addext = (imap->im_agctl[agno].numfree < 32 && iagp->nfreeexts); | 1421 | addext = (imap->im_agctl[agno].numfree < 32 && iagp->nfreeexts); |
1434 | 1422 | ||
1435 | /* | 1423 | /* |
1436 | * try to allocate from the IAG | 1424 | * try to allocate from the IAG |
1437 | */ | 1425 | */ |
1438 | /* check if the inode may be allocated from the iag | 1426 | /* check if the inode may be allocated from the iag |
1439 | * (i.e. the inode has free inodes or new extent can be added). | 1427 | * (i.e. the inode has free inodes or new extent can be added). |
@@ -1633,9 +1621,9 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) | |||
1633 | 1621 | ||
1634 | 1622 | ||
1635 | /* | 1623 | /* |
1636 | * NAME: diAllocAG(imap,agno,dir,ip) | 1624 | * NAME: diAllocAG(imap,agno,dir,ip) |
1637 | * | 1625 | * |
1638 | * FUNCTION: allocate a disk inode from the allocation group. | 1626 | * FUNCTION: allocate a disk inode from the allocation group. |
1639 | * | 1627 | * |
1640 | * this routine first determines if a new extent of free | 1628 | * this routine first determines if a new extent of free |
1641 | * inodes should be added for the allocation group, with | 1629 | * inodes should be added for the allocation group, with |
@@ -1649,17 +1637,17 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) | |||
1649 | * PRE CONDITION: Already have the AG lock for this AG. | 1637 | * PRE CONDITION: Already have the AG lock for this AG. |
1650 | * | 1638 | * |
1651 | * PARAMETERS: | 1639 | * PARAMETERS: |
1652 | * imap - pointer to inode map control structure. | 1640 | * imap - pointer to inode map control structure. |
1653 | * agno - allocation group to allocate from. | 1641 | * agno - allocation group to allocate from. |
1654 | * dir - 'true' if the new disk inode is for a directory. | 1642 | * 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 | 1643 | * ip - pointer to the new inode to be filled in on successful return |
1656 | * with the disk inode number allocated, its extent address | 1644 | * with the disk inode number allocated, its extent address |
1657 | * and the start of the ag. | 1645 | * and the start of the ag. |
1658 | * | 1646 | * |
1659 | * RETURN VALUES: | 1647 | * RETURN VALUES: |
1660 | * 0 - success. | 1648 | * 0 - success. |
1661 | * -ENOSPC - insufficient disk resources. | 1649 | * -ENOSPC - insufficient disk resources. |
1662 | * -EIO - i/o error. | 1650 | * -EIO - i/o error. |
1663 | */ | 1651 | */ |
1664 | static int | 1652 | static int |
1665 | diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip) | 1653 | diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip) |
@@ -1709,9 +1697,9 @@ diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip) | |||
1709 | 1697 | ||
1710 | 1698 | ||
1711 | /* | 1699 | /* |
1712 | * NAME: diAllocAny(imap,agno,dir,iap) | 1700 | * NAME: diAllocAny(imap,agno,dir,iap) |
1713 | * | 1701 | * |
1714 | * FUNCTION: allocate a disk inode from any other allocation group. | 1702 | * FUNCTION: allocate a disk inode from any other allocation group. |
1715 | * | 1703 | * |
1716 | * this routine is called when an allocation attempt within | 1704 | * this routine is called when an allocation attempt within |
1717 | * the primary allocation group has failed. if attempts to | 1705 | * the primary allocation group has failed. if attempts to |
@@ -1719,17 +1707,17 @@ diAllocAG(struct inomap * imap, int agno, bool dir, struct inode *ip) | |||
1719 | * specified primary group. | 1707 | * specified primary group. |
1720 | * | 1708 | * |
1721 | * PARAMETERS: | 1709 | * PARAMETERS: |
1722 | * imap - pointer to inode map control structure. | 1710 | * imap - pointer to inode map control structure. |
1723 | * agno - primary allocation group (to avoid). | 1711 | * agno - primary allocation group (to avoid). |
1724 | * dir - 'true' if the new disk inode is for a directory. | 1712 | * 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 | 1713 | * ip - pointer to a new inode to be filled in on successful return |
1726 | * with the disk inode number allocated, its extent address | 1714 | * with the disk inode number allocated, its extent address |
1727 | * and the start of the ag. | 1715 | * and the start of the ag. |
1728 | * | 1716 | * |
1729 | * RETURN VALUES: | 1717 | * RETURN VALUES: |
1730 | * 0 - success. | 1718 | * 0 - success. |
1731 | * -ENOSPC - insufficient disk resources. | 1719 | * -ENOSPC - insufficient disk resources. |
1732 | * -EIO - i/o error. | 1720 | * -EIO - i/o error. |
1733 | */ | 1721 | */ |
1734 | static int | 1722 | static int |
1735 | diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip) | 1723 | diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip) |
@@ -1772,9 +1760,9 @@ diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip) | |||
1772 | 1760 | ||
1773 | 1761 | ||
1774 | /* | 1762 | /* |
1775 | * NAME: diAllocIno(imap,agno,ip) | 1763 | * NAME: diAllocIno(imap,agno,ip) |
1776 | * | 1764 | * |
1777 | * FUNCTION: allocate a disk inode from the allocation group's free | 1765 | * FUNCTION: allocate a disk inode from the allocation group's free |
1778 | * inode list, returning an error if this free list is | 1766 | * inode list, returning an error if this free list is |
1779 | * empty (i.e. no iags on the list). | 1767 | * empty (i.e. no iags on the list). |
1780 | * | 1768 | * |
@@ -1785,16 +1773,16 @@ diAllocAny(struct inomap * imap, int agno, bool dir, struct inode *ip) | |||
1785 | * PRE CONDITION: Already have AG lock for this AG. | 1773 | * PRE CONDITION: Already have AG lock for this AG. |
1786 | * | 1774 | * |
1787 | * PARAMETERS: | 1775 | * PARAMETERS: |
1788 | * imap - pointer to inode map control structure. | 1776 | * imap - pointer to inode map control structure. |
1789 | * agno - allocation group. | 1777 | * agno - allocation group. |
1790 | * ip - pointer to new inode to be filled in on successful return | 1778 | * ip - pointer to new inode to be filled in on successful return |
1791 | * with the disk inode number allocated, its extent address | 1779 | * with the disk inode number allocated, its extent address |
1792 | * and the start of the ag. | 1780 | * and the start of the ag. |
1793 | * | 1781 | * |
1794 | * RETURN VALUES: | 1782 | * RETURN VALUES: |
1795 | * 0 - success. | 1783 | * 0 - success. |
1796 | * -ENOSPC - insufficient disk resources. | 1784 | * -ENOSPC - insufficient disk resources. |
1797 | * -EIO - i/o error. | 1785 | * -EIO - i/o error. |
1798 | */ | 1786 | */ |
1799 | static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) | 1787 | static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) |
1800 | { | 1788 | { |
@@ -1890,7 +1878,7 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) | |||
1890 | 1878 | ||
1891 | 1879 | ||
1892 | /* | 1880 | /* |
1893 | * NAME: diAllocExt(imap,agno,ip) | 1881 | * NAME: diAllocExt(imap,agno,ip) |
1894 | * | 1882 | * |
1895 | * FUNCTION: add a new extent of free inodes to an iag, allocating | 1883 | * FUNCTION: add a new extent of free inodes to an iag, allocating |
1896 | * an inode from this extent to satisfy the current allocation | 1884 | * an inode from this extent to satisfy the current allocation |
@@ -1910,16 +1898,16 @@ static int diAllocIno(struct inomap * imap, int agno, struct inode *ip) | |||
1910 | * for the purpose of satisfying this request. | 1898 | * for the purpose of satisfying this request. |
1911 | * | 1899 | * |
1912 | * PARAMETERS: | 1900 | * PARAMETERS: |
1913 | * imap - pointer to inode map control structure. | 1901 | * imap - pointer to inode map control structure. |
1914 | * agno - allocation group number. | 1902 | * agno - allocation group number. |
1915 | * ip - pointer to new inode to be filled in on successful return | 1903 | * ip - pointer to new inode to be filled in on successful return |
1916 | * with the disk inode number allocated, its extent address | 1904 | * with the disk inode number allocated, its extent address |
1917 | * and the start of the ag. | 1905 | * and the start of the ag. |
1918 | * | 1906 | * |
1919 | * RETURN VALUES: | 1907 | * RETURN VALUES: |
1920 | * 0 - success. | 1908 | * 0 - success. |
1921 | * -ENOSPC - insufficient disk resources. | 1909 | * -ENOSPC - insufficient disk resources. |
1922 | * -EIO - i/o error. | 1910 | * -EIO - i/o error. |
1923 | */ | 1911 | */ |
1924 | static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) | 1912 | static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) |
1925 | { | 1913 | { |
@@ -2010,7 +1998,7 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) | |||
2010 | 1998 | ||
2011 | 1999 | ||
2012 | /* | 2000 | /* |
2013 | * NAME: diAllocBit(imap,iagp,ino) | 2001 | * NAME: diAllocBit(imap,iagp,ino) |
2014 | * | 2002 | * |
2015 | * FUNCTION: allocate a backed inode from an iag. | 2003 | * FUNCTION: allocate a backed inode from an iag. |
2016 | * | 2004 | * |
@@ -2030,14 +2018,14 @@ static int diAllocExt(struct inomap * imap, int agno, struct inode *ip) | |||
2030 | * this AG. Must have read lock on imap inode. | 2018 | * this AG. Must have read lock on imap inode. |
2031 | * | 2019 | * |
2032 | * PARAMETERS: | 2020 | * PARAMETERS: |
2033 | * imap - pointer to inode map control structure. | 2021 | * imap - pointer to inode map control structure. |
2034 | * iagp - pointer to iag. | 2022 | * iagp - pointer to iag. |
2035 | * ino - inode number to be allocated within the iag. | 2023 | * ino - inode number to be allocated within the iag. |
2036 | * | 2024 | * |
2037 | * RETURN VALUES: | 2025 | * RETURN VALUES: |
2038 | * 0 - success. | 2026 | * 0 - success. |
2039 | * -ENOSPC - insufficient disk resources. | 2027 | * -ENOSPC - insufficient disk resources. |
2040 | * -EIO - i/o error. | 2028 | * -EIO - i/o error. |
2041 | */ | 2029 | */ |
2042 | static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) | 2030 | static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) |
2043 | { | 2031 | { |
@@ -2144,11 +2132,11 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) | |||
2144 | 2132 | ||
2145 | 2133 | ||
2146 | /* | 2134 | /* |
2147 | * NAME: diNewExt(imap,iagp,extno) | 2135 | * NAME: diNewExt(imap,iagp,extno) |
2148 | * | 2136 | * |
2149 | * FUNCTION: initialize a new extent of inodes for an iag, allocating | 2137 | * FUNCTION: initialize a new extent of inodes for an iag, allocating |
2150 | * the first inode of the extent for use for the current | 2138 | * the first inode of the extent for use for the current |
2151 | * allocation request. | 2139 | * allocation request. |
2152 | * | 2140 | * |
2153 | * disk resources are allocated for the new extent of inodes | 2141 | * disk resources are allocated for the new extent of inodes |
2154 | * and the inodes themselves are initialized to reflect their | 2142 | * and the inodes themselves are initialized to reflect their |
@@ -2177,14 +2165,14 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) | |||
2177 | * this AG. Must have read lock on imap inode. | 2165 | * this AG. Must have read lock on imap inode. |
2178 | * | 2166 | * |
2179 | * PARAMETERS: | 2167 | * PARAMETERS: |
2180 | * imap - pointer to inode map control structure. | 2168 | * imap - pointer to inode map control structure. |
2181 | * iagp - pointer to iag. | 2169 | * iagp - pointer to iag. |
2182 | * extno - extent number. | 2170 | * extno - extent number. |
2183 | * | 2171 | * |
2184 | * RETURN VALUES: | 2172 | * RETURN VALUES: |
2185 | * 0 - success. | 2173 | * 0 - success. |
2186 | * -ENOSPC - insufficient disk resources. | 2174 | * -ENOSPC - insufficient disk resources. |
2187 | * -EIO - i/o error. | 2175 | * -EIO - i/o error. |
2188 | */ | 2176 | */ |
2189 | static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) | 2177 | static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) |
2190 | { | 2178 | { |
@@ -2430,7 +2418,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) | |||
2430 | 2418 | ||
2431 | 2419 | ||
2432 | /* | 2420 | /* |
2433 | * NAME: diNewIAG(imap,iagnop,agno) | 2421 | * NAME: diNewIAG(imap,iagnop,agno) |
2434 | * | 2422 | * |
2435 | * FUNCTION: allocate a new iag for an allocation group. | 2423 | * FUNCTION: allocate a new iag for an allocation group. |
2436 | * | 2424 | * |
@@ -2443,16 +2431,16 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) | |||
2443 | * and returned to satisfy the request. | 2431 | * and returned to satisfy the request. |
2444 | * | 2432 | * |
2445 | * PARAMETERS: | 2433 | * PARAMETERS: |
2446 | * imap - pointer to inode map control structure. | 2434 | * imap - pointer to inode map control structure. |
2447 | * iagnop - pointer to an iag number set with the number of the | 2435 | * iagnop - pointer to an iag number set with the number of the |
2448 | * newly allocated iag upon successful return. | 2436 | * newly allocated iag upon successful return. |
2449 | * agno - allocation group number. | 2437 | * agno - allocation group number. |
2450 | * bpp - Buffer pointer to be filled in with new IAG's buffer | 2438 | * bpp - Buffer pointer to be filled in with new IAG's buffer |
2451 | * | 2439 | * |
2452 | * RETURN VALUES: | 2440 | * RETURN VALUES: |
2453 | * 0 - success. | 2441 | * 0 - success. |
2454 | * -ENOSPC - insufficient disk resources. | 2442 | * -ENOSPC - insufficient disk resources. |
2455 | * -EIO - i/o error. | 2443 | * -EIO - i/o error. |
2456 | * | 2444 | * |
2457 | * serialization: | 2445 | * serialization: |
2458 | * AG lock held on entry/exit; | 2446 | * AG lock held on entry/exit; |
@@ -2461,7 +2449,7 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) | |||
2461 | * | 2449 | * |
2462 | * note: new iag transaction: | 2450 | * note: new iag transaction: |
2463 | * . synchronously write iag; | 2451 | * . synchronously write iag; |
2464 | * . write log of xtree and inode of imap; | 2452 | * . write log of xtree and inode of imap; |
2465 | * . commit; | 2453 | * . commit; |
2466 | * . synchronous write of xtree (right to left, bottom to top); | 2454 | * . synchronous write of xtree (right to left, bottom to top); |
2467 | * . at start of logredo(): init in-memory imap with one additional iag page; | 2455 | * . at start of logredo(): init in-memory imap with one additional iag page; |
@@ -2481,9 +2469,6 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) | |||
2481 | s64 xaddr = 0; | 2469 | s64 xaddr = 0; |
2482 | s64 blkno; | 2470 | s64 blkno; |
2483 | tid_t tid; | 2471 | tid_t tid; |
2484 | #ifdef _STILL_TO_PORT | ||
2485 | xad_t xad; | ||
2486 | #endif /* _STILL_TO_PORT */ | ||
2487 | struct inode *iplist[1]; | 2472 | struct inode *iplist[1]; |
2488 | 2473 | ||
2489 | /* pick up pointers to the inode map and mount inodes */ | 2474 | /* pick up pointers to the inode map and mount inodes */ |
@@ -2674,15 +2659,15 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) | |||
2674 | } | 2659 | } |
2675 | 2660 | ||
2676 | /* | 2661 | /* |
2677 | * NAME: diIAGRead() | 2662 | * NAME: diIAGRead() |
2678 | * | 2663 | * |
2679 | * FUNCTION: get the buffer for the specified iag within a fileset | 2664 | * FUNCTION: get the buffer for the specified iag within a fileset |
2680 | * or aggregate inode map. | 2665 | * or aggregate inode map. |
2681 | * | 2666 | * |
2682 | * PARAMETERS: | 2667 | * PARAMETERS: |
2683 | * imap - pointer to inode map control structure. | 2668 | * imap - pointer to inode map control structure. |
2684 | * iagno - iag number. | 2669 | * iagno - iag number. |
2685 | * bpp - point to buffer pointer to be filled in on successful | 2670 | * bpp - point to buffer pointer to be filled in on successful |
2686 | * exit. | 2671 | * exit. |
2687 | * | 2672 | * |
2688 | * SERIALIZATION: | 2673 | * SERIALIZATION: |
@@ -2691,8 +2676,8 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) | |||
2691 | * the read lock is unnecessary.) | 2676 | * the read lock is unnecessary.) |
2692 | * | 2677 | * |
2693 | * RETURN VALUES: | 2678 | * RETURN VALUES: |
2694 | * 0 - success. | 2679 | * 0 - success. |
2695 | * -EIO - i/o error. | 2680 | * -EIO - i/o error. |
2696 | */ | 2681 | */ |
2697 | static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) | 2682 | static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) |
2698 | { | 2683 | { |
@@ -2712,17 +2697,17 @@ static int diIAGRead(struct inomap * imap, int iagno, struct metapage ** mpp) | |||
2712 | } | 2697 | } |
2713 | 2698 | ||
2714 | /* | 2699 | /* |
2715 | * NAME: diFindFree() | 2700 | * NAME: diFindFree() |
2716 | * | 2701 | * |
2717 | * FUNCTION: find the first free bit in a word starting at | 2702 | * FUNCTION: find the first free bit in a word starting at |
2718 | * the specified bit position. | 2703 | * the specified bit position. |
2719 | * | 2704 | * |
2720 | * PARAMETERS: | 2705 | * PARAMETERS: |
2721 | * word - word to be examined. | 2706 | * word - word to be examined. |
2722 | * start - starting bit position. | 2707 | * start - starting bit position. |
2723 | * | 2708 | * |
2724 | * RETURN VALUES: | 2709 | * RETURN VALUES: |
2725 | * bit position of first free bit in the word or 32 if | 2710 | * bit position of first free bit in the word or 32 if |
2726 | * no free bits were found. | 2711 | * no free bits were found. |
2727 | */ | 2712 | */ |
2728 | static int diFindFree(u32 word, int start) | 2713 | static int diFindFree(u32 word, int start) |
@@ -2897,7 +2882,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) | |||
2897 | atomic_read(&imap->im_numfree)); | 2882 | atomic_read(&imap->im_numfree)); |
2898 | 2883 | ||
2899 | /* | 2884 | /* |
2900 | * reconstruct imap | 2885 | * reconstruct imap |
2901 | * | 2886 | * |
2902 | * coalesce contiguous k (newAGSize/oldAGSize) AGs; | 2887 | * coalesce contiguous k (newAGSize/oldAGSize) AGs; |
2903 | * i.e., (AGi, ..., AGj) where i = k*n and j = k*(n+1) - 1 to AGn; | 2888 | * i.e., (AGi, ..., AGj) where i = k*n and j = k*(n+1) - 1 to AGn; |
@@ -2913,7 +2898,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) | |||
2913 | } | 2898 | } |
2914 | 2899 | ||
2915 | /* | 2900 | /* |
2916 | * process each iag page of the map. | 2901 | * process each iag page of the map. |
2917 | * | 2902 | * |
2918 | * rebuild AG Free Inode List, AG Free Inode Extent List; | 2903 | * rebuild AG Free Inode List, AG Free Inode Extent List; |
2919 | */ | 2904 | */ |
@@ -2932,7 +2917,7 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) | |||
2932 | 2917 | ||
2933 | /* leave free iag in the free iag list */ | 2918 | /* leave free iag in the free iag list */ |
2934 | if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG)) { | 2919 | if (iagp->nfreeexts == cpu_to_le32(EXTSPERIAG)) { |
2935 | release_metapage(bp); | 2920 | release_metapage(bp); |
2936 | continue; | 2921 | continue; |
2937 | } | 2922 | } |
2938 | 2923 | ||
@@ -3063,13 +3048,13 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno, | |||
3063 | } | 3048 | } |
3064 | 3049 | ||
3065 | /* | 3050 | /* |
3066 | * NAME: copy_from_dinode() | 3051 | * NAME: copy_from_dinode() |
3067 | * | 3052 | * |
3068 | * FUNCTION: Copies inode info from disk inode to in-memory inode | 3053 | * FUNCTION: Copies inode info from disk inode to in-memory inode |
3069 | * | 3054 | * |
3070 | * RETURN VALUES: | 3055 | * RETURN VALUES: |
3071 | * 0 - success | 3056 | * 0 - success |
3072 | * -ENOMEM - insufficient memory | 3057 | * -ENOMEM - insufficient memory |
3073 | */ | 3058 | */ |
3074 | static int copy_from_dinode(struct dinode * dip, struct inode *ip) | 3059 | static int copy_from_dinode(struct dinode * dip, struct inode *ip) |
3075 | { | 3060 | { |
@@ -3151,9 +3136,9 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) | |||
3151 | } | 3136 | } |
3152 | 3137 | ||
3153 | /* | 3138 | /* |
3154 | * NAME: copy_to_dinode() | 3139 | * NAME: copy_to_dinode() |
3155 | * | 3140 | * |
3156 | * FUNCTION: Copies inode info from in-memory inode to disk inode | 3141 | * FUNCTION: Copies inode info from in-memory inode to disk inode |
3157 | */ | 3142 | */ |
3158 | static void copy_to_dinode(struct dinode * dip, struct inode *ip) | 3143 | static void copy_to_dinode(struct dinode * dip, struct inode *ip) |
3159 | { | 3144 | { |