diff options
author | Dave Kleikamp <shaggy@linux.vnet.ibm.com> | 2007-06-06 16:28:35 -0400 |
---|---|---|
committer | Dave Kleikamp <shaggy@linux.vnet.ibm.com> | 2007-06-06 16:28:35 -0400 |
commit | f720e3ba558680cc7dd3995d005bdc8ee2ef46af (patch) | |
tree | 7217f0618795aa1c0a097adf73442842e6fd668c | |
parent | 5ecd3100e695228ac5e0ce0e325e252c0f11806f (diff) |
JFS: Whitespace cleanup and remove some dead code
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
-rw-r--r-- | fs/jfs/endian24.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_dinode.h | 42 | ||||
-rw-r--r-- | fs/jfs/jfs_dmap.c | 419 | ||||
-rw-r--r-- | fs/jfs/jfs_dmap.h | 118 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.c | 105 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_extent.c | 102 | ||||
-rw-r--r-- | fs/jfs/jfs_filsys.h | 13 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 293 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.h | 98 | ||||
-rw-r--r-- | fs/jfs/jfs_incore.h | 4 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 68 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.h | 26 | ||||
-rw-r--r-- | fs/jfs/jfs_mount.c | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 286 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_types.h | 20 | ||||
-rw-r--r-- | fs/jfs/jfs_umount.c | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_xtree.c | 428 | ||||
-rw-r--r-- | fs/jfs/jfs_xtree.h | 48 | ||||
-rw-r--r-- | fs/jfs/namei.c | 26 | ||||
-rw-r--r-- | fs/jfs/resize.c | 48 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 6 |
23 files changed, 1066 insertions, 1098 deletions
diff --git a/fs/jfs/endian24.h b/fs/jfs/endian24.h index 79494c4f2b10..fa92f7f1d0d0 100644 --- a/fs/jfs/endian24.h +++ b/fs/jfs/endian24.h | |||
@@ -29,7 +29,7 @@ | |||
29 | __u32 __x = (x); \ | 29 | __u32 __x = (x); \ |
30 | ((__u32)( \ | 30 | ((__u32)( \ |
31 | ((__x & (__u32)0x000000ffUL) << 16) | \ | 31 | ((__x & (__u32)0x000000ffUL) << 16) | \ |
32 | (__x & (__u32)0x0000ff00UL) | \ | 32 | (__x & (__u32)0x0000ff00UL) | \ |
33 | ((__x & (__u32)0x00ff0000UL) >> 16) )); \ | 33 | ((__x & (__u32)0x00ff0000UL) >> 16) )); \ |
34 | }) | 34 | }) |
35 | 35 | ||
diff --git a/fs/jfs/jfs_dinode.h b/fs/jfs/jfs_dinode.h index 40b20111383c..c387540d3425 100644 --- a/fs/jfs/jfs_dinode.h +++ b/fs/jfs/jfs_dinode.h | |||
@@ -19,23 +19,23 @@ | |||
19 | #define _H_JFS_DINODE | 19 | #define _H_JFS_DINODE |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * jfs_dinode.h: on-disk inode manager | 22 | * jfs_dinode.h: on-disk inode manager |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define INODESLOTSIZE 128 | 25 | #define INODESLOTSIZE 128 |
26 | #define L2INODESLOTSIZE 7 | 26 | #define L2INODESLOTSIZE 7 |
27 | #define log2INODESIZE 9 /* log2(bytes per dinode) */ | 27 | #define log2INODESIZE 9 /* log2(bytes per dinode) */ |
28 | 28 | ||
29 | 29 | ||
30 | /* | 30 | /* |
31 | * on-disk inode : 512 bytes | 31 | * on-disk inode : 512 bytes |
32 | * | 32 | * |
33 | * note: align 64-bit fields on 8-byte boundary. | 33 | * note: align 64-bit fields on 8-byte boundary. |
34 | */ | 34 | */ |
35 | struct dinode { | 35 | struct dinode { |
36 | /* | 36 | /* |
37 | * I. base area (128 bytes) | 37 | * I. base area (128 bytes) |
38 | * ------------------------ | 38 | * ------------------------ |
39 | * | 39 | * |
40 | * define generic/POSIX attributes | 40 | * define generic/POSIX attributes |
41 | */ | 41 | */ |
@@ -70,16 +70,16 @@ struct dinode { | |||
70 | __le32 di_acltype; /* 4: Type of ACL */ | 70 | __le32 di_acltype; /* 4: Type of ACL */ |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Extension Areas. | 73 | * Extension Areas. |
74 | * | 74 | * |
75 | * Historically, the inode was partitioned into 4 128-byte areas, | 75 | * Historically, the inode was partitioned into 4 128-byte areas, |
76 | * the last 3 being defined as unions which could have multiple | 76 | * the last 3 being defined as unions which could have multiple |
77 | * uses. The first 96 bytes had been completely unused until | 77 | * uses. The first 96 bytes had been completely unused until |
78 | * an index table was added to the directory. It is now more | 78 | * an index table was added to the directory. It is now more |
79 | * useful to describe the last 3/4 of the inode as a single | 79 | * useful to describe the last 3/4 of the inode as a single |
80 | * union. We would probably be better off redesigning the | 80 | * union. We would probably be better off redesigning the |
81 | * entire structure from scratch, but we don't want to break | 81 | * entire structure from scratch, but we don't want to break |
82 | * commonality with OS/2's JFS at this time. | 82 | * commonality with OS/2's JFS at this time. |
83 | */ | 83 | */ |
84 | union { | 84 | union { |
85 | struct { | 85 | struct { |
@@ -95,7 +95,7 @@ struct dinode { | |||
95 | } _dir; /* (384) */ | 95 | } _dir; /* (384) */ |
96 | #define di_dirtable u._dir._table | 96 | #define di_dirtable u._dir._table |
97 | #define di_dtroot u._dir._dtroot | 97 | #define di_dtroot u._dir._dtroot |
98 | #define di_parent di_dtroot.header.idotdot | 98 | #define di_parent di_dtroot.header.idotdot |
99 | #define di_DASD di_dtroot.header.DASD | 99 | #define di_DASD di_dtroot.header.DASD |
100 | 100 | ||
101 | struct { | 101 | struct { |
@@ -127,14 +127,14 @@ struct dinode { | |||
127 | #define di_inlinedata u._file._u2._special._u | 127 | #define di_inlinedata u._file._u2._special._u |
128 | #define di_rdev u._file._u2._special._u._rdev | 128 | #define di_rdev u._file._u2._special._u._rdev |
129 | #define di_fastsymlink u._file._u2._special._u._fastsymlink | 129 | #define di_fastsymlink u._file._u2._special._u._fastsymlink |
130 | #define di_inlineea u._file._u2._special._inlineea | 130 | #define di_inlineea u._file._u2._special._inlineea |
131 | } u; | 131 | } u; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | /* extended mode bits (on-disk inode di_mode) */ | 134 | /* extended mode bits (on-disk inode di_mode) */ |
135 | #define IFJOURNAL 0x00010000 /* journalled file */ | 135 | #define IFJOURNAL 0x00010000 /* journalled file */ |
136 | #define ISPARSE 0x00020000 /* sparse file enabled */ | 136 | #define ISPARSE 0x00020000 /* sparse file enabled */ |
137 | #define INLINEEA 0x00040000 /* inline EA area free */ | 137 | #define INLINEEA 0x00040000 /* inline EA area free */ |
138 | #define ISWAPFILE 0x00800000 /* file open for pager swap space */ | 138 | #define ISWAPFILE 0x00800000 /* file open for pager swap space */ |
139 | 139 | ||
140 | /* more extended mode bits: attributes for OS/2 */ | 140 | /* more extended mode bits: attributes for OS/2 */ |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index f3b1ebb22280..e1985066b1c6 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -154,12 +154,12 @@ static const s8 budtab[256] = { | |||
154 | * the in-core descriptor is initialized from disk. | 154 | * the in-core descriptor is initialized from disk. |
155 | * | 155 | * |
156 | * PARAMETERS: | 156 | * PARAMETERS: |
157 | * ipbmap - pointer to in-core inode for the block map. | 157 | * ipbmap - pointer to in-core inode for the block map. |
158 | * | 158 | * |
159 | * RETURN VALUES: | 159 | * RETURN VALUES: |
160 | * 0 - success | 160 | * 0 - success |
161 | * -ENOMEM - insufficient memory | 161 | * -ENOMEM - insufficient memory |
162 | * -EIO - i/o error | 162 | * -EIO - i/o error |
163 | */ | 163 | */ |
164 | int dbMount(struct inode *ipbmap) | 164 | int dbMount(struct inode *ipbmap) |
165 | { | 165 | { |
@@ -232,11 +232,11 @@ int dbMount(struct inode *ipbmap) | |||
232 | * the memory for this descriptor is freed. | 232 | * the memory for this descriptor is freed. |
233 | * | 233 | * |
234 | * PARAMETERS: | 234 | * PARAMETERS: |
235 | * ipbmap - pointer to in-core inode for the block map. | 235 | * ipbmap - pointer to in-core inode for the block map. |
236 | * | 236 | * |
237 | * RETURN VALUES: | 237 | * RETURN VALUES: |
238 | * 0 - success | 238 | * 0 - success |
239 | * -EIO - i/o error | 239 | * -EIO - i/o error |
240 | */ | 240 | */ |
241 | int dbUnmount(struct inode *ipbmap, int mounterror) | 241 | int dbUnmount(struct inode *ipbmap, int mounterror) |
242 | { | 242 | { |
@@ -320,13 +320,13 @@ int dbSync(struct inode *ipbmap) | |||
320 | * at a time. | 320 | * at a time. |
321 | * | 321 | * |
322 | * PARAMETERS: | 322 | * PARAMETERS: |
323 | * ip - pointer to in-core inode; | 323 | * ip - pointer to in-core inode; |
324 | * blkno - starting block number to be freed. | 324 | * blkno - starting block number to be freed. |
325 | * nblocks - number of blocks to be freed. | 325 | * nblocks - number of blocks to be freed. |
326 | * | 326 | * |
327 | * RETURN VALUES: | 327 | * RETURN VALUES: |
328 | * 0 - success | 328 | * 0 - success |
329 | * -EIO - i/o error | 329 | * -EIO - i/o error |
330 | */ | 330 | */ |
331 | int dbFree(struct inode *ip, s64 blkno, s64 nblocks) | 331 | int dbFree(struct inode *ip, s64 blkno, s64 nblocks) |
332 | { | 332 | { |
@@ -395,23 +395,23 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) | |||
395 | /* | 395 | /* |
396 | * NAME: dbUpdatePMap() | 396 | * NAME: dbUpdatePMap() |
397 | * | 397 | * |
398 | * FUNCTION: update the allocation state (free or allocate) of the | 398 | * FUNCTION: update the allocation state (free or allocate) of the |
399 | * specified block range in the persistent block allocation map. | 399 | * specified block range in the persistent block allocation map. |
400 | * | 400 | * |
401 | * the blocks will be updated in the persistent map one | 401 | * the blocks will be updated in the persistent map one |
402 | * dmap at a time. | 402 | * dmap at a time. |
403 | * | 403 | * |
404 | * PARAMETERS: | 404 | * PARAMETERS: |
405 | * ipbmap - pointer to in-core inode for the block map. | 405 | * ipbmap - pointer to in-core inode for the block map. |
406 | * free - 'true' if block range is to be freed from the persistent | 406 | * free - 'true' if block range is to be freed from the persistent |
407 | * map; 'false' if it is to be allocated. | 407 | * map; 'false' if it is to be allocated. |
408 | * blkno - starting block number of the range. | 408 | * blkno - starting block number of the range. |
409 | * nblocks - number of contiguous blocks in the range. | 409 | * nblocks - number of contiguous blocks in the range. |
410 | * tblk - transaction block; | 410 | * tblk - transaction block; |
411 | * | 411 | * |
412 | * RETURN VALUES: | 412 | * RETURN VALUES: |
413 | * 0 - success | 413 | * 0 - success |
414 | * -EIO - i/o error | 414 | * -EIO - i/o error |
415 | */ | 415 | */ |
416 | int | 416 | int |
417 | dbUpdatePMap(struct inode *ipbmap, | 417 | dbUpdatePMap(struct inode *ipbmap, |
@@ -573,7 +573,7 @@ dbUpdatePMap(struct inode *ipbmap, | |||
573 | /* | 573 | /* |
574 | * NAME: dbNextAG() | 574 | * NAME: dbNextAG() |
575 | * | 575 | * |
576 | * FUNCTION: find the preferred allocation group for new allocations. | 576 | * FUNCTION: find the preferred allocation group for new allocations. |
577 | * | 577 | * |
578 | * Within the allocation groups, we maintain a preferred | 578 | * Within the allocation groups, we maintain a preferred |
579 | * allocation group which consists of a group with at least | 579 | * allocation group which consists of a group with at least |
@@ -589,10 +589,10 @@ dbUpdatePMap(struct inode *ipbmap, | |||
589 | * empty ags around for large allocations. | 589 | * empty ags around for large allocations. |
590 | * | 590 | * |
591 | * PARAMETERS: | 591 | * PARAMETERS: |
592 | * ipbmap - pointer to in-core inode for the block map. | 592 | * ipbmap - pointer to in-core inode for the block map. |
593 | * | 593 | * |
594 | * RETURN VALUES: | 594 | * RETURN VALUES: |
595 | * the preferred allocation group number. | 595 | * the preferred allocation group number. |
596 | */ | 596 | */ |
597 | int dbNextAG(struct inode *ipbmap) | 597 | int dbNextAG(struct inode *ipbmap) |
598 | { | 598 | { |
@@ -656,7 +656,7 @@ unlock: | |||
656 | /* | 656 | /* |
657 | * NAME: dbAlloc() | 657 | * NAME: dbAlloc() |
658 | * | 658 | * |
659 | * FUNCTION: attempt to allocate a specified number of contiguous free | 659 | * FUNCTION: attempt to allocate a specified number of contiguous free |
660 | * blocks from the working allocation block map. | 660 | * blocks from the working allocation block map. |
661 | * | 661 | * |
662 | * the block allocation policy uses hints and a multi-step | 662 | * the block allocation policy uses hints and a multi-step |
@@ -680,16 +680,16 @@ unlock: | |||
680 | * size or requests that specify no hint value. | 680 | * size or requests that specify no hint value. |
681 | * | 681 | * |
682 | * PARAMETERS: | 682 | * PARAMETERS: |
683 | * ip - pointer to in-core inode; | 683 | * ip - pointer to in-core inode; |
684 | * hint - allocation hint. | 684 | * hint - allocation hint. |
685 | * nblocks - number of contiguous blocks in the range. | 685 | * nblocks - number of contiguous blocks in the range. |
686 | * results - on successful return, set to the starting block number | 686 | * results - on successful return, set to the starting block number |
687 | * of the newly allocated contiguous range. | 687 | * of the newly allocated contiguous range. |
688 | * | 688 | * |
689 | * RETURN VALUES: | 689 | * RETURN VALUES: |
690 | * 0 - success | 690 | * 0 - success |
691 | * -ENOSPC - insufficient disk resources | 691 | * -ENOSPC - insufficient disk resources |
692 | * -EIO - i/o error | 692 | * -EIO - i/o error |
693 | */ | 693 | */ |
694 | int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) | 694 | int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) |
695 | { | 695 | { |
@@ -706,12 +706,6 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) | |||
706 | /* assert that nblocks is valid */ | 706 | /* assert that nblocks is valid */ |
707 | assert(nblocks > 0); | 707 | assert(nblocks > 0); |
708 | 708 | ||
709 | #ifdef _STILL_TO_PORT | ||
710 | /* DASD limit check F226941 */ | ||
711 | if (OVER_LIMIT(ip, nblocks)) | ||
712 | return -ENOSPC; | ||
713 | #endif /* _STILL_TO_PORT */ | ||
714 | |||
715 | /* get the log2 number of blocks to be allocated. | 709 | /* get the log2 number of blocks to be allocated. |
716 | * if the number of blocks is not a log2 multiple, | 710 | * if the number of blocks is not a log2 multiple, |
717 | * it will be rounded up to the next log2 multiple. | 711 | * it will be rounded up to the next log2 multiple. |
@@ -720,7 +714,6 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) | |||
720 | 714 | ||
721 | bmp = JFS_SBI(ip->i_sb)->bmap; | 715 | bmp = JFS_SBI(ip->i_sb)->bmap; |
722 | 716 | ||
723 | //retry: /* serialize w.r.t.extendfs() */ | ||
724 | mapSize = bmp->db_mapsize; | 717 | mapSize = bmp->db_mapsize; |
725 | 718 | ||
726 | /* the hint should be within the map */ | 719 | /* the hint should be within the map */ |
@@ -879,17 +872,17 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results) | |||
879 | /* | 872 | /* |
880 | * NAME: dbAllocExact() | 873 | * NAME: dbAllocExact() |
881 | * | 874 | * |
882 | * FUNCTION: try to allocate the requested extent; | 875 | * FUNCTION: try to allocate the requested extent; |
883 | * | 876 | * |
884 | * PARAMETERS: | 877 | * PARAMETERS: |
885 | * ip - pointer to in-core inode; | 878 | * ip - pointer to in-core inode; |
886 | * blkno - extent address; | 879 | * blkno - extent address; |
887 | * nblocks - extent length; | 880 | * nblocks - extent length; |
888 | * | 881 | * |
889 | * RETURN VALUES: | 882 | * RETURN VALUES: |
890 | * 0 - success | 883 | * 0 - success |
891 | * -ENOSPC - insufficient disk resources | 884 | * -ENOSPC - insufficient disk resources |
892 | * -EIO - i/o error | 885 | * -EIO - i/o error |
893 | */ | 886 | */ |
894 | int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) | 887 | int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) |
895 | { | 888 | { |
@@ -946,7 +939,7 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) | |||
946 | /* | 939 | /* |
947 | * NAME: dbReAlloc() | 940 | * NAME: dbReAlloc() |
948 | * | 941 | * |
949 | * FUNCTION: attempt to extend a current allocation by a specified | 942 | * FUNCTION: attempt to extend a current allocation by a specified |
950 | * number of blocks. | 943 | * number of blocks. |
951 | * | 944 | * |
952 | * this routine attempts to satisfy the allocation request | 945 | * this routine attempts to satisfy the allocation request |
@@ -959,21 +952,21 @@ int dbAllocExact(struct inode *ip, s64 blkno, int nblocks) | |||
959 | * number of blocks required. | 952 | * number of blocks required. |
960 | * | 953 | * |
961 | * PARAMETERS: | 954 | * PARAMETERS: |
962 | * ip - pointer to in-core inode requiring allocation. | 955 | * ip - pointer to in-core inode requiring allocation. |
963 | * blkno - starting block of the current allocation. | 956 | * blkno - starting block of the current allocation. |
964 | * nblocks - number of contiguous blocks within the current | 957 | * nblocks - number of contiguous blocks within the current |
965 | * allocation. | 958 | * allocation. |
966 | * addnblocks - number of blocks to add to the allocation. | 959 | * addnblocks - number of blocks to add to the allocation. |
967 | * results - on successful return, set to the starting block number | 960 | * results - on successful return, set to the starting block number |
968 | * of the existing allocation if the existing allocation | 961 | * of the existing allocation if the existing allocation |
969 | * was extended in place or to a newly allocated contiguous | 962 | * was extended in place or to a newly allocated contiguous |
970 | * range if the existing allocation could not be extended | 963 | * range if the existing allocation could not be extended |
971 | * in place. | 964 | * in place. |
972 | * | 965 | * |
973 | * RETURN VALUES: | 966 | * RETURN VALUES: |
974 | * 0 - success | 967 | * 0 - success |
975 | * -ENOSPC - insufficient disk resources | 968 | * -ENOSPC - insufficient disk resources |
976 | * -EIO - i/o error | 969 | * -EIO - i/o error |
977 | */ | 970 | */ |
978 | int | 971 | int |
979 | dbReAlloc(struct inode *ip, | 972 | dbReAlloc(struct inode *ip, |
@@ -1004,7 +997,7 @@ dbReAlloc(struct inode *ip, | |||
1004 | /* | 997 | /* |
1005 | * NAME: dbExtend() | 998 | * NAME: dbExtend() |
1006 | * | 999 | * |
1007 | * FUNCTION: attempt to extend a current allocation by a specified | 1000 | * FUNCTION: attempt to extend a current allocation by a specified |
1008 | * number of blocks. | 1001 | * number of blocks. |
1009 | * | 1002 | * |
1010 | * this routine attempts to satisfy the allocation request | 1003 | * this routine attempts to satisfy the allocation request |
@@ -1013,16 +1006,16 @@ dbReAlloc(struct inode *ip, | |||
1013 | * immediately following the current allocation. | 1006 | * immediately following the current allocation. |
1014 | * | 1007 | * |
1015 | * PARAMETERS: | 1008 | * PARAMETERS: |
1016 | * ip - pointer to in-core inode requiring allocation. | 1009 | * ip - pointer to in-core inode requiring allocation. |
1017 | * blkno - starting block of the current allocation. | 1010 | * blkno - starting block of the current allocation. |
1018 | * nblocks - number of contiguous blocks within the current | 1011 | * nblocks - number of contiguous blocks within the current |
1019 | * allocation. | 1012 | * allocation. |
1020 | * addnblocks - number of blocks to add to the allocation. | 1013 | * addnblocks - number of blocks to add to the allocation. |
1021 | * | 1014 | * |
1022 | * RETURN VALUES: | 1015 | * RETURN VALUES: |
1023 | * 0 - success | 1016 | * 0 - success |
1024 | * -ENOSPC - insufficient disk resources | 1017 | * -ENOSPC - insufficient disk resources |
1025 | * -EIO - i/o error | 1018 | * -EIO - i/o error |
1026 | */ | 1019 | */ |
1027 | static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) | 1020 | static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) |
1028 | { | 1021 | { |
@@ -1109,19 +1102,19 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks) | |||
1109 | /* | 1102 | /* |
1110 | * NAME: dbAllocNext() | 1103 | * NAME: dbAllocNext() |
1111 | * | 1104 | * |
1112 | * FUNCTION: attempt to allocate the blocks of the specified block | 1105 | * FUNCTION: attempt to allocate the blocks of the specified block |
1113 | * range within a dmap. | 1106 | * range within a dmap. |
1114 | * | 1107 | * |
1115 | * PARAMETERS: | 1108 | * PARAMETERS: |
1116 | * bmp - pointer to bmap descriptor | 1109 | * bmp - pointer to bmap descriptor |
1117 | * dp - pointer to dmap. | 1110 | * dp - pointer to dmap. |
1118 | * blkno - starting block number of the range. | 1111 | * blkno - starting block number of the range. |
1119 | * nblocks - number of contiguous free blocks of the range. | 1112 | * nblocks - number of contiguous free blocks of the range. |
1120 | * | 1113 | * |
1121 | * RETURN VALUES: | 1114 | * RETURN VALUES: |
1122 | * 0 - success | 1115 | * 0 - success |
1123 | * -ENOSPC - insufficient disk resources | 1116 | * -ENOSPC - insufficient disk resources |
1124 | * -EIO - i/o error | 1117 | * -EIO - i/o error |
1125 | * | 1118 | * |
1126 | * serialization: IREAD_LOCK(ipbmap) held on entry/exit; | 1119 | * serialization: IREAD_LOCK(ipbmap) held on entry/exit; |
1127 | */ | 1120 | */ |
@@ -1233,7 +1226,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
1233 | /* | 1226 | /* |
1234 | * NAME: dbAllocNear() | 1227 | * NAME: dbAllocNear() |
1235 | * | 1228 | * |
1236 | * FUNCTION: attempt to allocate a number of contiguous free blocks near | 1229 | * FUNCTION: attempt to allocate a number of contiguous free blocks near |
1237 | * a specified block (hint) within a dmap. | 1230 | * a specified block (hint) within a dmap. |
1238 | * | 1231 | * |
1239 | * starting with the dmap leaf that covers the hint, we'll | 1232 | * starting with the dmap leaf that covers the hint, we'll |
@@ -1242,18 +1235,18 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
1242 | * the desired free space. | 1235 | * the desired free space. |
1243 | * | 1236 | * |
1244 | * PARAMETERS: | 1237 | * PARAMETERS: |
1245 | * bmp - pointer to bmap descriptor | 1238 | * bmp - pointer to bmap descriptor |
1246 | * dp - pointer to dmap. | 1239 | * dp - pointer to dmap. |
1247 | * blkno - block number to allocate near. | 1240 | * blkno - block number to allocate near. |
1248 | * nblocks - actual number of contiguous free blocks desired. | 1241 | * nblocks - actual number of contiguous free blocks desired. |
1249 | * l2nb - log2 number of contiguous free blocks desired. | 1242 | * l2nb - log2 number of contiguous free blocks desired. |
1250 | * results - on successful return, set to the starting block number | 1243 | * results - on successful return, set to the starting block number |
1251 | * of the newly allocated range. | 1244 | * of the newly allocated range. |
1252 | * | 1245 | * |
1253 | * RETURN VALUES: | 1246 | * RETURN VALUES: |
1254 | * 0 - success | 1247 | * 0 - success |
1255 | * -ENOSPC - insufficient disk resources | 1248 | * -ENOSPC - insufficient disk resources |
1256 | * -EIO - i/o error | 1249 | * -EIO - i/o error |
1257 | * | 1250 | * |
1258 | * serialization: IREAD_LOCK(ipbmap) held on entry/exit; | 1251 | * serialization: IREAD_LOCK(ipbmap) held on entry/exit; |
1259 | */ | 1252 | */ |
@@ -1316,7 +1309,7 @@ dbAllocNear(struct bmap * bmp, | |||
1316 | /* | 1309 | /* |
1317 | * NAME: dbAllocAG() | 1310 | * NAME: dbAllocAG() |
1318 | * | 1311 | * |
1319 | * FUNCTION: attempt to allocate the specified number of contiguous | 1312 | * FUNCTION: attempt to allocate the specified number of contiguous |
1320 | * free blocks within the specified allocation group. | 1313 | * free blocks within the specified allocation group. |
1321 | * | 1314 | * |
1322 | * unless the allocation group size is equal to the number | 1315 | * unless the allocation group size is equal to the number |
@@ -1353,17 +1346,17 @@ dbAllocNear(struct bmap * bmp, | |||
1353 | * the allocation group. | 1346 | * the allocation group. |
1354 | * | 1347 | * |
1355 | * PARAMETERS: | 1348 | * PARAMETERS: |
1356 | * bmp - pointer to bmap descriptor | 1349 | * bmp - pointer to bmap descriptor |
1357 | * agno - allocation group number. | 1350 | * agno - allocation group number. |
1358 | * nblocks - actual number of contiguous free blocks desired. | 1351 | * nblocks - actual number of contiguous free blocks desired. |
1359 | * l2nb - log2 number of contiguous free blocks desired. | 1352 | * l2nb - log2 number of contiguous free blocks desired. |
1360 | * results - on successful return, set to the starting block number | 1353 | * results - on successful return, set to the starting block number |
1361 | * of the newly allocated range. | 1354 | * of the newly allocated range. |
1362 | * | 1355 | * |
1363 | * RETURN VALUES: | 1356 | * RETURN VALUES: |
1364 | * 0 - success | 1357 | * 0 - success |
1365 | * -ENOSPC - insufficient disk resources | 1358 | * -ENOSPC - insufficient disk resources |
1366 | * -EIO - i/o error | 1359 | * -EIO - i/o error |
1367 | * | 1360 | * |
1368 | * note: IWRITE_LOCK(ipmap) held on entry/exit; | 1361 | * note: IWRITE_LOCK(ipmap) held on entry/exit; |
1369 | */ | 1362 | */ |
@@ -1546,7 +1539,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) | |||
1546 | /* | 1539 | /* |
1547 | * NAME: dbAllocAny() | 1540 | * NAME: dbAllocAny() |
1548 | * | 1541 | * |
1549 | * FUNCTION: attempt to allocate the specified number of contiguous | 1542 | * FUNCTION: attempt to allocate the specified number of contiguous |
1550 | * free blocks anywhere in the file system. | 1543 | * free blocks anywhere in the file system. |
1551 | * | 1544 | * |
1552 | * dbAllocAny() attempts to find the sufficient free space by | 1545 | * dbAllocAny() attempts to find the sufficient free space by |
@@ -1556,16 +1549,16 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) | |||
1556 | * desired free space is allocated. | 1549 | * desired free space is allocated. |
1557 | * | 1550 | * |
1558 | * PARAMETERS: | 1551 | * PARAMETERS: |
1559 | * bmp - pointer to bmap descriptor | 1552 | * bmp - pointer to bmap descriptor |
1560 | * nblocks - actual number of contiguous free blocks desired. | 1553 | * nblocks - actual number of contiguous free blocks desired. |
1561 | * l2nb - log2 number of contiguous free blocks desired. | 1554 | * l2nb - log2 number of contiguous free blocks desired. |
1562 | * results - on successful return, set to the starting block number | 1555 | * results - on successful return, set to the starting block number |
1563 | * of the newly allocated range. | 1556 | * of the newly allocated range. |
1564 | * | 1557 | * |
1565 | * RETURN VALUES: | 1558 | * RETURN VALUES: |
1566 | * 0 - success | 1559 | * 0 - success |
1567 | * -ENOSPC - insufficient disk resources | 1560 | * -ENOSPC - insufficient disk resources |
1568 | * -EIO - i/o error | 1561 | * -EIO - i/o error |
1569 | * | 1562 | * |
1570 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; | 1563 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; |
1571 | */ | 1564 | */ |
@@ -1598,9 +1591,9 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) | |||
1598 | /* | 1591 | /* |
1599 | * NAME: dbFindCtl() | 1592 | * NAME: dbFindCtl() |
1600 | * | 1593 | * |
1601 | * FUNCTION: starting at a specified dmap control page level and block | 1594 | * FUNCTION: starting at a specified dmap control page level and block |
1602 | * number, search down the dmap control levels for a range of | 1595 | * number, search down the dmap control levels for a range of |
1603 | * contiguous free blocks large enough to satisfy an allocation | 1596 | * contiguous free blocks large enough to satisfy an allocation |
1604 | * request for the specified number of free blocks. | 1597 | * request for the specified number of free blocks. |
1605 | * | 1598 | * |
1606 | * if sufficient contiguous free blocks are found, this routine | 1599 | * if sufficient contiguous free blocks are found, this routine |
@@ -1609,17 +1602,17 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results) | |||
1609 | * is sufficient in size. | 1602 | * is sufficient in size. |
1610 | * | 1603 | * |
1611 | * PARAMETERS: | 1604 | * PARAMETERS: |
1612 | * bmp - pointer to bmap descriptor | 1605 | * bmp - pointer to bmap descriptor |
1613 | * level - starting dmap control page level. | 1606 | * level - starting dmap control page level. |
1614 | * l2nb - log2 number of contiguous free blocks desired. | 1607 | * l2nb - log2 number of contiguous free blocks desired. |
1615 | * *blkno - on entry, starting block number for conducting the search. | 1608 | * *blkno - on entry, starting block number for conducting the search. |
1616 | * on successful return, the first block within a dmap page | 1609 | * on successful return, the first block within a dmap page |
1617 | * that contains or starts a range of contiguous free blocks. | 1610 | * that contains or starts a range of contiguous free blocks. |
1618 | * | 1611 | * |
1619 | * RETURN VALUES: | 1612 | * RETURN VALUES: |
1620 | * 0 - success | 1613 | * 0 - success |
1621 | * -ENOSPC - insufficient disk resources | 1614 | * -ENOSPC - insufficient disk resources |
1622 | * -EIO - i/o error | 1615 | * -EIO - i/o error |
1623 | * | 1616 | * |
1624 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; | 1617 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; |
1625 | */ | 1618 | */ |
@@ -1699,7 +1692,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno) | |||
1699 | /* | 1692 | /* |
1700 | * NAME: dbAllocCtl() | 1693 | * NAME: dbAllocCtl() |
1701 | * | 1694 | * |
1702 | * FUNCTION: attempt to allocate a specified number of contiguous | 1695 | * FUNCTION: attempt to allocate a specified number of contiguous |
1703 | * blocks starting within a specific dmap. | 1696 | * blocks starting within a specific dmap. |
1704 | * | 1697 | * |
1705 | * this routine is called by higher level routines that search | 1698 | * this routine is called by higher level routines that search |
@@ -1726,18 +1719,18 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno) | |||
1726 | * first dmap (i.e. blkno). | 1719 | * first dmap (i.e. blkno). |
1727 | * | 1720 | * |
1728 | * PARAMETERS: | 1721 | * PARAMETERS: |
1729 | * bmp - pointer to bmap descriptor | 1722 | * bmp - pointer to bmap descriptor |
1730 | * nblocks - actual number of contiguous free blocks to allocate. | 1723 | * nblocks - actual number of contiguous free blocks to allocate. |
1731 | * l2nb - log2 number of contiguous free blocks to allocate. | 1724 | * l2nb - log2 number of contiguous free blocks to allocate. |
1732 | * blkno - starting block number of the dmap to start the allocation | 1725 | * blkno - starting block number of the dmap to start the allocation |
1733 | * from. | 1726 | * from. |
1734 | * results - on successful return, set to the starting block number | 1727 | * results - on successful return, set to the starting block number |
1735 | * of the newly allocated range. | 1728 | * of the newly allocated range. |
1736 | * | 1729 | * |
1737 | * RETURN VALUES: | 1730 | * RETURN VALUES: |
1738 | * 0 - success | 1731 | * 0 - success |
1739 | * -ENOSPC - insufficient disk resources | 1732 | * -ENOSPC - insufficient disk resources |
1740 | * -EIO - i/o error | 1733 | * -EIO - i/o error |
1741 | * | 1734 | * |
1742 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; | 1735 | * serialization: IWRITE_LOCK(ipbmap) held on entry/exit; |
1743 | */ | 1736 | */ |
@@ -1870,7 +1863,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) | |||
1870 | /* | 1863 | /* |
1871 | * NAME: dbAllocDmapLev() | 1864 | * NAME: dbAllocDmapLev() |
1872 | * | 1865 | * |
1873 | * FUNCTION: attempt to allocate a specified number of contiguous blocks | 1866 | * FUNCTION: attempt to allocate a specified number of contiguous blocks |
1874 | * from a specified dmap. | 1867 | * from a specified dmap. |
1875 | * | 1868 | * |
1876 | * this routine checks if the contiguous blocks are available. | 1869 | * this routine checks if the contiguous blocks are available. |
@@ -1878,17 +1871,17 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) | |||
1878 | * returned. | 1871 | * returned. |
1879 | * | 1872 | * |
1880 | * PARAMETERS: | 1873 | * PARAMETERS: |
1881 | * mp - pointer to bmap descriptor | 1874 | * mp - pointer to bmap descriptor |
1882 | * dp - pointer to dmap to attempt to allocate blocks from. | 1875 | * dp - pointer to dmap to attempt to allocate blocks from. |
1883 | * l2nb - log2 number of contiguous block desired. | 1876 | * l2nb - log2 number of contiguous block desired. |
1884 | * nblocks - actual number of contiguous block desired. | 1877 | * nblocks - actual number of contiguous block desired. |
1885 | * results - on successful return, set to the starting block number | 1878 | * results - on successful return, set to the starting block number |
1886 | * of the newly allocated range. | 1879 | * of the newly allocated range. |
1887 | * | 1880 | * |
1888 | * RETURN VALUES: | 1881 | * RETURN VALUES: |
1889 | * 0 - success | 1882 | * 0 - success |
1890 | * -ENOSPC - insufficient disk resources | 1883 | * -ENOSPC - insufficient disk resources |
1891 | * -EIO - i/o error | 1884 | * -EIO - i/o error |
1892 | * | 1885 | * |
1893 | * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or | 1886 | * serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or |
1894 | * IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit; | 1887 | * IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit; |
@@ -1933,7 +1926,7 @@ dbAllocDmapLev(struct bmap * bmp, | |||
1933 | /* | 1926 | /* |
1934 | * NAME: dbAllocDmap() | 1927 | * NAME: dbAllocDmap() |
1935 | * | 1928 | * |
1936 | * FUNCTION: adjust the disk allocation map to reflect the allocation | 1929 | * FUNCTION: adjust the disk allocation map to reflect the allocation |
1937 | * of a specified block range within a dmap. | 1930 | * of a specified block range within a dmap. |
1938 | * | 1931 | * |
1939 | * this routine allocates the specified blocks from the dmap | 1932 | * this routine allocates the specified blocks from the dmap |
@@ -1946,14 +1939,14 @@ dbAllocDmapLev(struct bmap * bmp, | |||
1946 | * covers this dmap. | 1939 | * covers this dmap. |
1947 | * | 1940 | * |
1948 | * PARAMETERS: | 1941 | * PARAMETERS: |
1949 | * bmp - pointer to bmap descriptor | 1942 | * bmp - pointer to bmap descriptor |
1950 | * dp - pointer to dmap to allocate the block range from. | 1943 | * dp - pointer to dmap to allocate the block range from. |
1951 | * blkno - starting block number of the block to be allocated. | 1944 | * blkno - starting block number of the block to be allocated. |
1952 | * nblocks - number of blocks to be allocated. | 1945 | * nblocks - number of blocks to be allocated. |
1953 | * | 1946 | * |
1954 | * RETURN VALUES: | 1947 | * RETURN VALUES: |
1955 | * 0 - success | 1948 | * 0 - success |
1956 | * -EIO - i/o error | 1949 | * -EIO - i/o error |
1957 | * | 1950 | * |
1958 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; | 1951 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; |
1959 | */ | 1952 | */ |
@@ -1989,7 +1982,7 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
1989 | /* | 1982 | /* |
1990 | * NAME: dbFreeDmap() | 1983 | * NAME: dbFreeDmap() |
1991 | * | 1984 | * |
1992 | * FUNCTION: adjust the disk allocation map to reflect the allocation | 1985 | * FUNCTION: adjust the disk allocation map to reflect the allocation |
1993 | * of a specified block range within a dmap. | 1986 | * of a specified block range within a dmap. |
1994 | * | 1987 | * |
1995 | * this routine frees the specified blocks from the dmap through | 1988 | * this routine frees the specified blocks from the dmap through |
@@ -1997,18 +1990,18 @@ static int dbAllocDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
1997 | * causes the maximum string of free blocks within the dmap to | 1990 | * causes the maximum string of free blocks within the dmap to |
1998 | * change (i.e. the value of the root of the dmap's dmtree), this | 1991 | * change (i.e. the value of the root of the dmap's dmtree), this |
1999 | * routine will cause this change to be reflected up through the | 1992 | * routine will cause this change to be reflected up through the |
2000 | * appropriate levels of the dmap control pages by a call to | 1993 | * appropriate levels of the dmap control pages by a call to |
2001 | * dbAdjCtl() for the L0 dmap control page that covers this dmap. | 1994 | * dbAdjCtl() for the L0 dmap control page that covers this dmap. |
2002 | * | 1995 | * |
2003 | * PARAMETERS: | 1996 | * PARAMETERS: |
2004 | * bmp - pointer to bmap descriptor | 1997 | * bmp - pointer to bmap descriptor |
2005 | * dp - pointer to dmap to free the block range from. | 1998 | * dp - pointer to dmap to free the block range from. |
2006 | * blkno - starting block number of the block to be freed. | 1999 | * blkno - starting block number of the block to be freed. |
2007 | * nblocks - number of blocks to be freed. | 2000 | * nblocks - number of blocks to be freed. |
2008 | * | 2001 | * |
2009 | * RETURN VALUES: | 2002 | * RETURN VALUES: |
2010 | * 0 - success | 2003 | * 0 - success |
2011 | * -EIO - i/o error | 2004 | * -EIO - i/o error |
2012 | * | 2005 | * |
2013 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; | 2006 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; |
2014 | */ | 2007 | */ |
@@ -2055,7 +2048,7 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2055 | /* | 2048 | /* |
2056 | * NAME: dbAllocBits() | 2049 | * NAME: dbAllocBits() |
2057 | * | 2050 | * |
2058 | * FUNCTION: allocate a specified block range from a dmap. | 2051 | * FUNCTION: allocate a specified block range from a dmap. |
2059 | * | 2052 | * |
2060 | * this routine updates the dmap to reflect the working | 2053 | * this routine updates the dmap to reflect the working |
2061 | * state allocation of the specified block range. it directly | 2054 | * state allocation of the specified block range. it directly |
@@ -2065,10 +2058,10 @@ static int dbFreeDmap(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2065 | * dmap's dmtree, as a whole, to reflect the allocated range. | 2058 | * dmap's dmtree, as a whole, to reflect the allocated range. |
2066 | * | 2059 | * |
2067 | * PARAMETERS: | 2060 | * PARAMETERS: |
2068 | * bmp - pointer to bmap descriptor | 2061 | * bmp - pointer to bmap descriptor |
2069 | * dp - pointer to dmap to allocate bits from. | 2062 | * dp - pointer to dmap to allocate bits from. |
2070 | * blkno - starting block number of the bits to be allocated. | 2063 | * blkno - starting block number of the bits to be allocated. |
2071 | * nblocks - number of bits to be allocated. | 2064 | * nblocks - number of bits to be allocated. |
2072 | * | 2065 | * |
2073 | * RETURN VALUES: none | 2066 | * RETURN VALUES: none |
2074 | * | 2067 | * |
@@ -2149,7 +2142,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2149 | * the allocated words. | 2142 | * the allocated words. |
2150 | */ | 2143 | */ |
2151 | for (; nwords > 0; nwords -= nw) { | 2144 | for (; nwords > 0; nwords -= nw) { |
2152 | if (leaf[word] < BUDMIN) { | 2145 | if (leaf[word] < BUDMIN) { |
2153 | jfs_error(bmp->db_ipbmap->i_sb, | 2146 | jfs_error(bmp->db_ipbmap->i_sb, |
2154 | "dbAllocBits: leaf page " | 2147 | "dbAllocBits: leaf page " |
2155 | "corrupt"); | 2148 | "corrupt"); |
@@ -2202,7 +2195,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2202 | /* | 2195 | /* |
2203 | * NAME: dbFreeBits() | 2196 | * NAME: dbFreeBits() |
2204 | * | 2197 | * |
2205 | * FUNCTION: free a specified block range from a dmap. | 2198 | * FUNCTION: free a specified block range from a dmap. |
2206 | * | 2199 | * |
2207 | * this routine updates the dmap to reflect the working | 2200 | * this routine updates the dmap to reflect the working |
2208 | * state allocation of the specified block range. it directly | 2201 | * state allocation of the specified block range. it directly |
@@ -2212,10 +2205,10 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2212 | * dmtree, as a whole, to reflect the deallocated range. | 2205 | * dmtree, as a whole, to reflect the deallocated range. |
2213 | * | 2206 | * |
2214 | * PARAMETERS: | 2207 | * PARAMETERS: |
2215 | * bmp - pointer to bmap descriptor | 2208 | * bmp - pointer to bmap descriptor |
2216 | * dp - pointer to dmap to free bits from. | 2209 | * dp - pointer to dmap to free bits from. |
2217 | * blkno - starting block number of the bits to be freed. | 2210 | * blkno - starting block number of the bits to be freed. |
2218 | * nblocks - number of bits to be freed. | 2211 | * nblocks - number of bits to be freed. |
2219 | * | 2212 | * |
2220 | * RETURN VALUES: 0 for success | 2213 | * RETURN VALUES: 0 for success |
2221 | * | 2214 | * |
@@ -2388,19 +2381,19 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2388 | * the new root value and the next dmap control page level to | 2381 | * the new root value and the next dmap control page level to |
2389 | * be adjusted. | 2382 | * be adjusted. |
2390 | * PARAMETERS: | 2383 | * PARAMETERS: |
2391 | * bmp - pointer to bmap descriptor | 2384 | * bmp - pointer to bmap descriptor |
2392 | * blkno - the first block of a block range within a dmap. it is | 2385 | * blkno - the first block of a block range within a dmap. it is |
2393 | * the allocation or deallocation of this block range that | 2386 | * the allocation or deallocation of this block range that |
2394 | * requires the dmap control page to be adjusted. | 2387 | * requires the dmap control page to be adjusted. |
2395 | * newval - the new value of the lower level dmap or dmap control | 2388 | * newval - the new value of the lower level dmap or dmap control |
2396 | * page root. | 2389 | * page root. |
2397 | * alloc - 'true' if adjustment is due to an allocation. | 2390 | * alloc - 'true' if adjustment is due to an allocation. |
2398 | * level - current level of dmap control page (i.e. L0, L1, L2) to | 2391 | * level - current level of dmap control page (i.e. L0, L1, L2) to |
2399 | * be adjusted. | 2392 | * be adjusted. |
2400 | * | 2393 | * |
2401 | * RETURN VALUES: | 2394 | * RETURN VALUES: |
2402 | * 0 - success | 2395 | * 0 - success |
2403 | * -EIO - i/o error | 2396 | * -EIO - i/o error |
2404 | * | 2397 | * |
2405 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; | 2398 | * serialization: IREAD_LOCK(ipbmap) or IWRITE_LOCK(ipbmap) held on entry/exit; |
2406 | */ | 2399 | */ |
@@ -2544,16 +2537,16 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) | |||
2544 | /* | 2537 | /* |
2545 | * NAME: dbSplit() | 2538 | * NAME: dbSplit() |
2546 | * | 2539 | * |
2547 | * FUNCTION: update the leaf of a dmtree with a new value, splitting | 2540 | * FUNCTION: update the leaf of a dmtree with a new value, splitting |
2548 | * the leaf from the binary buddy system of the dmtree's | 2541 | * the leaf from the binary buddy system of the dmtree's |
2549 | * leaves, as required. | 2542 | * leaves, as required. |
2550 | * | 2543 | * |
2551 | * PARAMETERS: | 2544 | * PARAMETERS: |
2552 | * tp - pointer to the tree containing the leaf. | 2545 | * tp - pointer to the tree containing the leaf. |
2553 | * leafno - the number of the leaf to be updated. | 2546 | * leafno - the number of the leaf to be updated. |
2554 | * splitsz - the size the binary buddy system starting at the leaf | 2547 | * splitsz - the size the binary buddy system starting at the leaf |
2555 | * must be split to, specified as the log2 number of blocks. | 2548 | * must be split to, specified as the log2 number of blocks. |
2556 | * newval - the new value for the leaf. | 2549 | * newval - the new value for the leaf. |
2557 | * | 2550 | * |
2558 | * RETURN VALUES: none | 2551 | * RETURN VALUES: none |
2559 | * | 2552 | * |
@@ -2600,7 +2593,7 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) | |||
2600 | /* | 2593 | /* |
2601 | * NAME: dbBackSplit() | 2594 | * NAME: dbBackSplit() |
2602 | * | 2595 | * |
2603 | * FUNCTION: back split the binary buddy system of dmtree leaves | 2596 | * FUNCTION: back split the binary buddy system of dmtree leaves |
2604 | * that hold a specified leaf until the specified leaf | 2597 | * that hold a specified leaf until the specified leaf |
2605 | * starts its own binary buddy system. | 2598 | * starts its own binary buddy system. |
2606 | * | 2599 | * |
@@ -2617,8 +2610,8 @@ static void dbSplit(dmtree_t * tp, int leafno, int splitsz, int newval) | |||
2617 | * in which a previous join operation must be backed out. | 2610 | * in which a previous join operation must be backed out. |
2618 | * | 2611 | * |
2619 | * PARAMETERS: | 2612 | * PARAMETERS: |
2620 | * tp - pointer to the tree containing the leaf. | 2613 | * tp - pointer to the tree containing the leaf. |
2621 | * leafno - the number of the leaf to be updated. | 2614 | * leafno - the number of the leaf to be updated. |
2622 | * | 2615 | * |
2623 | * RETURN VALUES: none | 2616 | * RETURN VALUES: none |
2624 | * | 2617 | * |
@@ -2692,14 +2685,14 @@ static int dbBackSplit(dmtree_t * tp, int leafno) | |||
2692 | /* | 2685 | /* |
2693 | * NAME: dbJoin() | 2686 | * NAME: dbJoin() |
2694 | * | 2687 | * |
2695 | * FUNCTION: update the leaf of a dmtree with a new value, joining | 2688 | * FUNCTION: update the leaf of a dmtree with a new value, joining |
2696 | * the leaf with other leaves of the dmtree into a multi-leaf | 2689 | * the leaf with other leaves of the dmtree into a multi-leaf |
2697 | * binary buddy system, as required. | 2690 | * binary buddy system, as required. |
2698 | * | 2691 | * |
2699 | * PARAMETERS: | 2692 | * PARAMETERS: |
2700 | * tp - pointer to the tree containing the leaf. | 2693 | * tp - pointer to the tree containing the leaf. |
2701 | * leafno - the number of the leaf to be updated. | 2694 | * leafno - the number of the leaf to be updated. |
2702 | * newval - the new value for the leaf. | 2695 | * newval - the new value for the leaf. |
2703 | * | 2696 | * |
2704 | * RETURN VALUES: none | 2697 | * RETURN VALUES: none |
2705 | */ | 2698 | */ |
@@ -2785,15 +2778,15 @@ static int dbJoin(dmtree_t * tp, int leafno, int newval) | |||
2785 | /* | 2778 | /* |
2786 | * NAME: dbAdjTree() | 2779 | * NAME: dbAdjTree() |
2787 | * | 2780 | * |
2788 | * FUNCTION: update a leaf of a dmtree with a new value, adjusting | 2781 | * FUNCTION: update a leaf of a dmtree with a new value, adjusting |
2789 | * the dmtree, as required, to reflect the new leaf value. | 2782 | * the dmtree, as required, to reflect the new leaf value. |
2790 | * the combination of any buddies must already be done before | 2783 | * the combination of any buddies must already be done before |
2791 | * this is called. | 2784 | * this is called. |
2792 | * | 2785 | * |
2793 | * PARAMETERS: | 2786 | * PARAMETERS: |
2794 | * tp - pointer to the tree to be adjusted. | 2787 | * tp - pointer to the tree to be adjusted. |
2795 | * leafno - the number of the leaf to be updated. | 2788 | * leafno - the number of the leaf to be updated. |
2796 | * newval - the new value for the leaf. | 2789 | * newval - the new value for the leaf. |
2797 | * | 2790 | * |
2798 | * RETURN VALUES: none | 2791 | * RETURN VALUES: none |
2799 | */ | 2792 | */ |
@@ -2852,7 +2845,7 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval) | |||
2852 | /* | 2845 | /* |
2853 | * NAME: dbFindLeaf() | 2846 | * NAME: dbFindLeaf() |
2854 | * | 2847 | * |
2855 | * FUNCTION: search a dmtree_t for sufficient free blocks, returning | 2848 | * FUNCTION: search a dmtree_t for sufficient free blocks, returning |
2856 | * the index of a leaf describing the free blocks if | 2849 | * the index of a leaf describing the free blocks if |
2857 | * sufficient free blocks are found. | 2850 | * sufficient free blocks are found. |
2858 | * | 2851 | * |
@@ -2861,15 +2854,15 @@ static void dbAdjTree(dmtree_t * tp, int leafno, int newval) | |||
2861 | * free space. | 2854 | * free space. |
2862 | * | 2855 | * |
2863 | * PARAMETERS: | 2856 | * PARAMETERS: |
2864 | * tp - pointer to the tree to be searched. | 2857 | * tp - pointer to the tree to be searched. |
2865 | * l2nb - log2 number of free blocks to search for. | 2858 | * l2nb - log2 number of free blocks to search for. |
2866 | * leafidx - return pointer to be set to the index of the leaf | 2859 | * leafidx - return pointer to be set to the index of the leaf |
2867 | * describing at least l2nb free blocks if sufficient | 2860 | * describing at least l2nb free blocks if sufficient |
2868 | * free blocks are found. | 2861 | * free blocks are found. |
2869 | * | 2862 | * |
2870 | * RETURN VALUES: | 2863 | * RETURN VALUES: |
2871 | * 0 - success | 2864 | * 0 - success |
2872 | * -ENOSPC - insufficient free blocks. | 2865 | * -ENOSPC - insufficient free blocks. |
2873 | */ | 2866 | */ |
2874 | static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) | 2867 | static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) |
2875 | { | 2868 | { |
@@ -2916,18 +2909,18 @@ static int dbFindLeaf(dmtree_t * tp, int l2nb, int *leafidx) | |||
2916 | /* | 2909 | /* |
2917 | * NAME: dbFindBits() | 2910 | * NAME: dbFindBits() |
2918 | * | 2911 | * |
2919 | * FUNCTION: find a specified number of binary buddy free bits within a | 2912 | * FUNCTION: find a specified number of binary buddy free bits within a |
2920 | * dmap bitmap word value. | 2913 | * dmap bitmap word value. |
2921 | * | 2914 | * |
2922 | * this routine searches the bitmap value for (1 << l2nb) free | 2915 | * this routine searches the bitmap value for (1 << l2nb) free |
2923 | * bits at (1 << l2nb) alignments within the value. | 2916 | * bits at (1 << l2nb) alignments within the value. |
2924 | * | 2917 | * |
2925 | * PARAMETERS: | 2918 | * PARAMETERS: |
2926 | * word - dmap bitmap word value. | 2919 | * word - dmap bitmap word value. |
2927 | * l2nb - number of free bits specified as a log2 number. | 2920 | * l2nb - number of free bits specified as a log2 number. |
2928 | * | 2921 | * |
2929 | * RETURN VALUES: | 2922 | * RETURN VALUES: |
2930 | * starting bit number of free bits. | 2923 | * starting bit number of free bits. |
2931 | */ | 2924 | */ |
2932 | static int dbFindBits(u32 word, int l2nb) | 2925 | static int dbFindBits(u32 word, int l2nb) |
2933 | { | 2926 | { |
@@ -2963,14 +2956,14 @@ static int dbFindBits(u32 word, int l2nb) | |||
2963 | /* | 2956 | /* |
2964 | * NAME: dbMaxBud(u8 *cp) | 2957 | * NAME: dbMaxBud(u8 *cp) |
2965 | * | 2958 | * |
2966 | * FUNCTION: determine the largest binary buddy string of free | 2959 | * FUNCTION: determine the largest binary buddy string of free |
2967 | * bits within 32-bits of the map. | 2960 | * bits within 32-bits of the map. |
2968 | * | 2961 | * |
2969 | * PARAMETERS: | 2962 | * PARAMETERS: |
2970 | * cp - pointer to the 32-bit value. | 2963 | * cp - pointer to the 32-bit value. |
2971 | * | 2964 | * |
2972 | * RETURN VALUES: | 2965 | * RETURN VALUES: |
2973 | * largest binary buddy of free bits within a dmap word. | 2966 | * largest binary buddy of free bits within a dmap word. |
2974 | */ | 2967 | */ |
2975 | static int dbMaxBud(u8 * cp) | 2968 | static int dbMaxBud(u8 * cp) |
2976 | { | 2969 | { |
@@ -3000,14 +2993,14 @@ static int dbMaxBud(u8 * cp) | |||
3000 | /* | 2993 | /* |
3001 | * NAME: cnttz(uint word) | 2994 | * NAME: cnttz(uint word) |
3002 | * | 2995 | * |
3003 | * FUNCTION: determine the number of trailing zeros within a 32-bit | 2996 | * FUNCTION: determine the number of trailing zeros within a 32-bit |
3004 | * value. | 2997 | * value. |
3005 | * | 2998 | * |
3006 | * PARAMETERS: | 2999 | * PARAMETERS: |
3007 | * value - 32-bit value to be examined. | 3000 | * value - 32-bit value to be examined. |
3008 | * | 3001 | * |
3009 | * RETURN VALUES: | 3002 | * RETURN VALUES: |
3010 | * count of trailing zeros | 3003 | * count of trailing zeros |
3011 | */ | 3004 | */ |
3012 | static int cnttz(u32 word) | 3005 | static int cnttz(u32 word) |
3013 | { | 3006 | { |
@@ -3025,14 +3018,14 @@ static int cnttz(u32 word) | |||
3025 | /* | 3018 | /* |
3026 | * NAME: cntlz(u32 value) | 3019 | * NAME: cntlz(u32 value) |
3027 | * | 3020 | * |
3028 | * FUNCTION: determine the number of leading zeros within a 32-bit | 3021 | * FUNCTION: determine the number of leading zeros within a 32-bit |
3029 | * value. | 3022 | * value. |
3030 | * | 3023 | * |
3031 | * PARAMETERS: | 3024 | * PARAMETERS: |
3032 | * value - 32-bit value to be examined. | 3025 | * value - 32-bit value to be examined. |
3033 | * | 3026 | * |
3034 | * RETURN VALUES: | 3027 | * RETURN VALUES: |
3035 | * count of leading zeros | 3028 | * count of leading zeros |
3036 | */ | 3029 | */ |
3037 | static int cntlz(u32 value) | 3030 | static int cntlz(u32 value) |
3038 | { | 3031 | { |
@@ -3050,14 +3043,14 @@ static int cntlz(u32 value) | |||
3050 | * NAME: blkstol2(s64 nb) | 3043 | * NAME: blkstol2(s64 nb) |
3051 | * | 3044 | * |
3052 | * FUNCTION: convert a block count to its log2 value. if the block | 3045 | * FUNCTION: convert a block count to its log2 value. if the block |
3053 | * count is not a l2 multiple, it is rounded up to the next | 3046 | * count is not a l2 multiple, it is rounded up to the next |
3054 | * larger l2 multiple. | 3047 | * larger l2 multiple. |
3055 | * | 3048 | * |
3056 | * PARAMETERS: | 3049 | * PARAMETERS: |
3057 | * nb - number of blocks | 3050 | * nb - number of blocks |
3058 | * | 3051 | * |
3059 | * RETURN VALUES: | 3052 | * RETURN VALUES: |
3060 | * log2 number of blocks | 3053 | * log2 number of blocks |
3061 | */ | 3054 | */ |
3062 | static int blkstol2(s64 nb) | 3055 | static int blkstol2(s64 nb) |
3063 | { | 3056 | { |
@@ -3099,13 +3092,13 @@ static int blkstol2(s64 nb) | |||
3099 | * at a time. | 3092 | * at a time. |
3100 | * | 3093 | * |
3101 | * PARAMETERS: | 3094 | * PARAMETERS: |
3102 | * ip - pointer to in-core inode; | 3095 | * ip - pointer to in-core inode; |
3103 | * blkno - starting block number to be freed. | 3096 | * blkno - starting block number to be freed. |
3104 | * nblocks - number of blocks to be freed. | 3097 | * nblocks - number of blocks to be freed. |
3105 | * | 3098 | * |
3106 | * RETURN VALUES: | 3099 | * RETURN VALUES: |
3107 | * 0 - success | 3100 | * 0 - success |
3108 | * -EIO - i/o error | 3101 | * -EIO - i/o error |
3109 | */ | 3102 | */ |
3110 | int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) | 3103 | int dbAllocBottomUp(struct inode *ip, s64 blkno, s64 nblocks) |
3111 | { | 3104 | { |
@@ -3278,10 +3271,10 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
3278 | * L2 | 3271 | * L2 |
3279 | * | | 3272 | * | |
3280 | * L1---------------------------------L1 | 3273 | * L1---------------------------------L1 |
3281 | * | | | 3274 | * | | |
3282 | * L0---------L0---------L0 L0---------L0---------L0 | 3275 | * L0---------L0---------L0 L0---------L0---------L0 |
3283 | * | | | | | | | 3276 | * | | | | | | |
3284 | * d0,...,dn d0,...,dn d0,...,dn d0,...,dn d0,...,dn d0,.,dm; | 3277 | * d0,...,dn d0,...,dn d0,...,dn d0,...,dn d0,...,dn d0,.,dm; |
3285 | * L2L1L0d0,...,dnL0d0,...,dnL0d0,...,dnL1L0d0,...,dnL0d0,...,dnL0d0,..dm | 3278 | * L2L1L0d0,...,dnL0d0,...,dnL0d0,...,dnL1L0d0,...,dnL0d0,...,dnL0d0,..dm |
3286 | * | 3279 | * |
3287 | * <---old---><----------------------------extend-----------------------> | 3280 | * <---old---><----------------------------extend-----------------------> |
@@ -3307,7 +3300,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) | |||
3307 | (long long) blkno, (long long) nblocks, (long long) newsize); | 3300 | (long long) blkno, (long long) nblocks, (long long) newsize); |
3308 | 3301 | ||
3309 | /* | 3302 | /* |
3310 | * initialize bmap control page. | 3303 | * initialize bmap control page. |
3311 | * | 3304 | * |
3312 | * all the data in bmap control page should exclude | 3305 | * all the data in bmap control page should exclude |
3313 | * the mkfs hidden dmap page. | 3306 | * the mkfs hidden dmap page. |
@@ -3330,7 +3323,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) | |||
3330 | bmp->db_numag += ((u32) newsize % (u32) bmp->db_agsize) ? 1 : 0; | 3323 | bmp->db_numag += ((u32) newsize % (u32) bmp->db_agsize) ? 1 : 0; |
3331 | 3324 | ||
3332 | /* | 3325 | /* |
3333 | * reconfigure db_agfree[] | 3326 | * reconfigure db_agfree[] |
3334 | * from old AG configuration to new AG configuration; | 3327 | * from old AG configuration to new AG configuration; |
3335 | * | 3328 | * |
3336 | * coalesce contiguous k (newAGSize/oldAGSize) AGs; | 3329 | * coalesce contiguous k (newAGSize/oldAGSize) AGs; |
@@ -3362,7 +3355,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) | |||
3362 | bmp->db_maxag = bmp->db_maxag / k; | 3355 | bmp->db_maxag = bmp->db_maxag / k; |
3363 | 3356 | ||
3364 | /* | 3357 | /* |
3365 | * extend bmap | 3358 | * extend bmap |
3366 | * | 3359 | * |
3367 | * update bit maps and corresponding level control pages; | 3360 | * update bit maps and corresponding level control pages; |
3368 | * global control page db_nfree, db_agfree[agno], db_maxfreebud; | 3361 | * global control page db_nfree, db_agfree[agno], db_maxfreebud; |
@@ -3410,7 +3403,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) | |||
3410 | /* compute start L0 */ | 3403 | /* compute start L0 */ |
3411 | j = 0; | 3404 | j = 0; |
3412 | l1leaf = l1dcp->stree + CTLLEAFIND; | 3405 | l1leaf = l1dcp->stree + CTLLEAFIND; |
3413 | p += nbperpage; /* 1st L0 of L1.k */ | 3406 | p += nbperpage; /* 1st L0 of L1.k */ |
3414 | } | 3407 | } |
3415 | 3408 | ||
3416 | /* | 3409 | /* |
@@ -3548,7 +3541,7 @@ errout: | |||
3548 | return -EIO; | 3541 | return -EIO; |
3549 | 3542 | ||
3550 | /* | 3543 | /* |
3551 | * finalize bmap control page | 3544 | * finalize bmap control page |
3552 | */ | 3545 | */ |
3553 | finalize: | 3546 | finalize: |
3554 | 3547 | ||
@@ -3567,7 +3560,7 @@ void dbFinalizeBmap(struct inode *ipbmap) | |||
3567 | int i, n; | 3560 | int i, n; |
3568 | 3561 | ||
3569 | /* | 3562 | /* |
3570 | * finalize bmap control page | 3563 | * finalize bmap control page |
3571 | */ | 3564 | */ |
3572 | //finalize: | 3565 | //finalize: |
3573 | /* | 3566 | /* |
@@ -3953,8 +3946,8 @@ static int dbGetL2AGSize(s64 nblocks) | |||
3953 | * convert number of map pages to the zero origin top dmapctl level | 3946 | * convert number of map pages to the zero origin top dmapctl level |
3954 | */ | 3947 | */ |
3955 | #define BMAPPGTOLEV(npages) \ | 3948 | #define BMAPPGTOLEV(npages) \ |
3956 | (((npages) <= 3 + MAXL0PAGES) ? 0 \ | 3949 | (((npages) <= 3 + MAXL0PAGES) ? 0 : \ |
3957 | : ((npages) <= 2 + MAXL1PAGES) ? 1 : 2) | 3950 | ((npages) <= 2 + MAXL1PAGES) ? 1 : 2) |
3958 | 3951 | ||
3959 | s64 dbMapFileSizeToMapSize(struct inode * ipbmap) | 3952 | s64 dbMapFileSizeToMapSize(struct inode * ipbmap) |
3960 | { | 3953 | { |
@@ -3981,8 +3974,8 @@ s64 dbMapFileSizeToMapSize(struct inode * ipbmap) | |||
3981 | factor = | 3974 | factor = |
3982 | (i == 2) ? MAXL1PAGES : ((i == 1) ? MAXL0PAGES : 1); | 3975 | (i == 2) ? MAXL1PAGES : ((i == 1) ? MAXL0PAGES : 1); |
3983 | complete = (u32) npages / factor; | 3976 | complete = (u32) npages / factor; |
3984 | ndmaps += complete * ((i == 2) ? LPERCTL * LPERCTL | 3977 | ndmaps += complete * ((i == 2) ? LPERCTL * LPERCTL : |
3985 | : ((i == 1) ? LPERCTL : 1)); | 3978 | ((i == 1) ? LPERCTL : 1)); |
3986 | 3979 | ||
3987 | /* pages in last/incomplete child */ | 3980 | /* pages in last/incomplete child */ |
3988 | npages = (u32) npages % factor; | 3981 | npages = (u32) npages % factor; |
diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h index 45ea454c74bd..11e6d471b364 100644 --- a/fs/jfs/jfs_dmap.h +++ b/fs/jfs/jfs_dmap.h | |||
@@ -83,7 +83,7 @@ static __inline signed char TREEMAX(signed char *cp) | |||
83 | * - 1 is added to account for the control page of the map. | 83 | * - 1 is added to account for the control page of the map. |
84 | */ | 84 | */ |
85 | #define BLKTODMAP(b,s) \ | 85 | #define BLKTODMAP(b,s) \ |
86 | ((((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) << (s)) | 86 | ((((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) << (s)) |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * convert disk block number to the logical block number of the LEVEL 0 | 89 | * convert disk block number to the logical block number of the LEVEL 0 |
@@ -98,7 +98,7 @@ static __inline signed char TREEMAX(signed char *cp) | |||
98 | * - 1 is added to account for the control page of the map. | 98 | * - 1 is added to account for the control page of the map. |
99 | */ | 99 | */ |
100 | #define BLKTOL0(b,s) \ | 100 | #define BLKTOL0(b,s) \ |
101 | (((((b) >> 23) << 10) + ((b) >> 23) + ((b) >> 33) + 2 + 1) << (s)) | 101 | (((((b) >> 23) << 10) + ((b) >> 23) + ((b) >> 33) + 2 + 1) << (s)) |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * convert disk block number to the logical block number of the LEVEL 1 | 104 | * convert disk block number to the logical block number of the LEVEL 1 |
@@ -120,7 +120,7 @@ static __inline signed char TREEMAX(signed char *cp) | |||
120 | * at the specified level which describes the disk block. | 120 | * at the specified level which describes the disk block. |
121 | */ | 121 | */ |
122 | #define BLKTOCTL(b,s,l) \ | 122 | #define BLKTOCTL(b,s,l) \ |
123 | (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s))) | 123 | (((l) == 2) ? 1 : ((l) == 1) ? BLKTOL1((b),(s)) : BLKTOL0((b),(s))) |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * convert aggregate map size to the zero origin dmapctl level of the | 126 | * convert aggregate map size to the zero origin dmapctl level of the |
@@ -145,27 +145,27 @@ static __inline signed char TREEMAX(signed char *cp) | |||
145 | * dmaptree must be consistent with dmapctl. | 145 | * dmaptree must be consistent with dmapctl. |
146 | */ | 146 | */ |
147 | struct dmaptree { | 147 | struct dmaptree { |
148 | __le32 nleafs; /* 4: number of tree leafs */ | 148 | __le32 nleafs; /* 4: number of tree leafs */ |
149 | __le32 l2nleafs; /* 4: l2 number of tree leafs */ | 149 | __le32 l2nleafs; /* 4: l2 number of tree leafs */ |
150 | __le32 leafidx; /* 4: index of first tree leaf */ | 150 | __le32 leafidx; /* 4: index of first tree leaf */ |
151 | __le32 height; /* 4: height of the tree */ | 151 | __le32 height; /* 4: height of the tree */ |
152 | s8 budmin; /* 1: min l2 tree leaf value to combine */ | 152 | s8 budmin; /* 1: min l2 tree leaf value to combine */ |
153 | s8 stree[TREESIZE]; /* TREESIZE: tree */ | 153 | s8 stree[TREESIZE]; /* TREESIZE: tree */ |
154 | u8 pad[2]; /* 2: pad to word boundary */ | 154 | u8 pad[2]; /* 2: pad to word boundary */ |
155 | }; /* - 360 - */ | 155 | }; /* - 360 - */ |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * dmap page per 8K blocks bitmap | 158 | * dmap page per 8K blocks bitmap |
159 | */ | 159 | */ |
160 | struct dmap { | 160 | struct dmap { |
161 | __le32 nblocks; /* 4: num blks covered by this dmap */ | 161 | __le32 nblocks; /* 4: num blks covered by this dmap */ |
162 | __le32 nfree; /* 4: num of free blks in this dmap */ | 162 | __le32 nfree; /* 4: num of free blks in this dmap */ |
163 | __le64 start; /* 8: starting blkno for this dmap */ | 163 | __le64 start; /* 8: starting blkno for this dmap */ |
164 | struct dmaptree tree; /* 360: dmap tree */ | 164 | struct dmaptree tree; /* 360: dmap tree */ |
165 | u8 pad[1672]; /* 1672: pad to 2048 bytes */ | 165 | u8 pad[1672]; /* 1672: pad to 2048 bytes */ |
166 | __le32 wmap[LPERDMAP]; /* 1024: bits of the working map */ | 166 | __le32 wmap[LPERDMAP]; /* 1024: bits of the working map */ |
167 | __le32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */ | 167 | __le32 pmap[LPERDMAP]; /* 1024: bits of the persistent map */ |
168 | }; /* - 4096 - */ | 168 | }; /* - 4096 - */ |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * disk map control page per level. | 171 | * disk map control page per level. |
@@ -173,14 +173,14 @@ struct dmap { | |||
173 | * dmapctl must be consistent with dmaptree. | 173 | * dmapctl must be consistent with dmaptree. |
174 | */ | 174 | */ |
175 | struct dmapctl { | 175 | struct dmapctl { |
176 | __le32 nleafs; /* 4: number of tree leafs */ | 176 | __le32 nleafs; /* 4: number of tree leafs */ |
177 | __le32 l2nleafs; /* 4: l2 number of tree leafs */ | 177 | __le32 l2nleafs; /* 4: l2 number of tree leafs */ |
178 | __le32 leafidx; /* 4: index of the first tree leaf */ | 178 | __le32 leafidx; /* 4: index of the first tree leaf */ |
179 | __le32 height; /* 4: height of tree */ | 179 | __le32 height; /* 4: height of tree */ |
180 | s8 budmin; /* 1: minimum l2 tree leaf value */ | 180 | s8 budmin; /* 1: minimum l2 tree leaf value */ |
181 | s8 stree[CTLTREESIZE]; /* CTLTREESIZE: dmapctl tree */ | 181 | s8 stree[CTLTREESIZE]; /* CTLTREESIZE: dmapctl tree */ |
182 | u8 pad[2714]; /* 2714: pad to 4096 */ | 182 | u8 pad[2714]; /* 2714: pad to 4096 */ |
183 | }; /* - 4096 - */ | 183 | }; /* - 4096 - */ |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * common definition for dmaptree within dmap and dmapctl | 186 | * common definition for dmaptree within dmap and dmapctl |
@@ -202,41 +202,41 @@ typedef union dmtree { | |||
202 | * on-disk aggregate disk allocation map descriptor. | 202 | * on-disk aggregate disk allocation map descriptor. |
203 | */ | 203 | */ |
204 | struct dbmap_disk { | 204 | struct dbmap_disk { |
205 | __le64 dn_mapsize; /* 8: number of blocks in aggregate */ | 205 | __le64 dn_mapsize; /* 8: number of blocks in aggregate */ |
206 | __le64 dn_nfree; /* 8: num free blks in aggregate map */ | 206 | __le64 dn_nfree; /* 8: num free blks in aggregate map */ |
207 | __le32 dn_l2nbperpage; /* 4: number of blks per page */ | 207 | __le32 dn_l2nbperpage; /* 4: number of blks per page */ |
208 | __le32 dn_numag; /* 4: total number of ags */ | 208 | __le32 dn_numag; /* 4: total number of ags */ |
209 | __le32 dn_maxlevel; /* 4: number of active ags */ | 209 | __le32 dn_maxlevel; /* 4: number of active ags */ |
210 | __le32 dn_maxag; /* 4: max active alloc group number */ | 210 | __le32 dn_maxag; /* 4: max active alloc group number */ |
211 | __le32 dn_agpref; /* 4: preferred alloc group (hint) */ | 211 | __le32 dn_agpref; /* 4: preferred alloc group (hint) */ |
212 | __le32 dn_aglevel; /* 4: dmapctl level holding the AG */ | 212 | __le32 dn_aglevel; /* 4: dmapctl level holding the AG */ |
213 | __le32 dn_agheigth; /* 4: height in dmapctl of the AG */ | 213 | __le32 dn_agheigth; /* 4: height in dmapctl of the AG */ |
214 | __le32 dn_agwidth; /* 4: width in dmapctl of the AG */ | 214 | __le32 dn_agwidth; /* 4: width in dmapctl of the AG */ |
215 | __le32 dn_agstart; /* 4: start tree index at AG height */ | 215 | __le32 dn_agstart; /* 4: start tree index at AG height */ |
216 | __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */ | 216 | __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */ |
217 | __le64 dn_agfree[MAXAG];/* 8*MAXAG: per AG free count */ | 217 | __le64 dn_agfree[MAXAG];/* 8*MAXAG: per AG free count */ |
218 | __le64 dn_agsize; /* 8: num of blks per alloc group */ | 218 | __le64 dn_agsize; /* 8: num of blks per alloc group */ |
219 | s8 dn_maxfreebud; /* 1: max free buddy system */ | 219 | s8 dn_maxfreebud; /* 1: max free buddy system */ |
220 | u8 pad[3007]; /* 3007: pad to 4096 */ | 220 | u8 pad[3007]; /* 3007: pad to 4096 */ |
221 | }; /* - 4096 - */ | 221 | }; /* - 4096 - */ |
222 | 222 | ||
223 | struct dbmap { | 223 | struct dbmap { |
224 | s64 dn_mapsize; /* number of blocks in aggregate */ | 224 | s64 dn_mapsize; /* number of blocks in aggregate */ |
225 | s64 dn_nfree; /* num free blks in aggregate map */ | 225 | s64 dn_nfree; /* num free blks in aggregate map */ |
226 | int dn_l2nbperpage; /* number of blks per page */ | 226 | int dn_l2nbperpage; /* number of blks per page */ |
227 | int dn_numag; /* total number of ags */ | 227 | int dn_numag; /* total number of ags */ |
228 | int dn_maxlevel; /* number of active ags */ | 228 | int dn_maxlevel; /* number of active ags */ |
229 | int dn_maxag; /* max active alloc group number */ | 229 | int dn_maxag; /* max active alloc group number */ |
230 | int dn_agpref; /* preferred alloc group (hint) */ | 230 | int dn_agpref; /* preferred alloc group (hint) */ |
231 | int dn_aglevel; /* dmapctl level holding the AG */ | 231 | int dn_aglevel; /* dmapctl level holding the AG */ |
232 | int dn_agheigth; /* height in dmapctl of the AG */ | 232 | int dn_agheigth; /* height in dmapctl of the AG */ |
233 | int dn_agwidth; /* width in dmapctl of the AG */ | 233 | int dn_agwidth; /* width in dmapctl of the AG */ |
234 | int dn_agstart; /* start tree index at AG height */ | 234 | int dn_agstart; /* start tree index at AG height */ |
235 | int dn_agl2size; /* l2 num of blks per alloc group */ | 235 | int dn_agl2size; /* l2 num of blks per alloc group */ |
236 | s64 dn_agfree[MAXAG]; /* per AG free count */ | 236 | s64 dn_agfree[MAXAG]; /* per AG free count */ |
237 | s64 dn_agsize; /* num of blks per alloc group */ | 237 | s64 dn_agsize; /* num of blks per alloc group */ |
238 | signed char dn_maxfreebud; /* max free buddy system */ | 238 | signed char dn_maxfreebud; /* max free buddy system */ |
239 | }; /* - 4096 - */ | 239 | }; /* - 4096 - */ |
240 | /* | 240 | /* |
241 | * in-memory aggregate disk allocation map descriptor. | 241 | * in-memory aggregate disk allocation map descriptor. |
242 | */ | 242 | */ |
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 6d62f3222892..c14ba3cfa818 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -315,8 +315,8 @@ static inline void lock_index(tid_t tid, struct inode *ip, struct metapage * mp, | |||
315 | lv = &llck->lv[llck->index]; | 315 | lv = &llck->lv[llck->index]; |
316 | 316 | ||
317 | /* | 317 | /* |
318 | * Linelock slot size is twice the size of directory table | 318 | * Linelock slot size is twice the size of directory table |
319 | * slot size. 512 entries per page. | 319 | * slot size. 512 entries per page. |
320 | */ | 320 | */ |
321 | lv->offset = ((index - 2) & 511) >> 1; | 321 | lv->offset = ((index - 2) & 511) >> 1; |
322 | lv->length = 1; | 322 | lv->length = 1; |
@@ -615,7 +615,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, | |||
615 | btstack->nsplit = 1; | 615 | btstack->nsplit = 1; |
616 | 616 | ||
617 | /* | 617 | /* |
618 | * search down tree from root: | 618 | * search down tree from root: |
619 | * | 619 | * |
620 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of | 620 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of |
621 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. | 621 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. |
@@ -659,7 +659,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, | |||
659 | } | 659 | } |
660 | if (cmp == 0) { | 660 | if (cmp == 0) { |
661 | /* | 661 | /* |
662 | * search hit | 662 | * search hit |
663 | */ | 663 | */ |
664 | /* search hit - leaf page: | 664 | /* search hit - leaf page: |
665 | * return the entry found | 665 | * return the entry found |
@@ -723,7 +723,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, | |||
723 | } | 723 | } |
724 | 724 | ||
725 | /* | 725 | /* |
726 | * search miss | 726 | * search miss |
727 | * | 727 | * |
728 | * base is the smallest index with key (Kj) greater than | 728 | * base is the smallest index with key (Kj) greater than |
729 | * search key (K) and may be zero or (maxindex + 1) index. | 729 | * search key (K) and may be zero or (maxindex + 1) index. |
@@ -834,7 +834,7 @@ int dtInsert(tid_t tid, struct inode *ip, | |||
834 | struct lv *lv; | 834 | struct lv *lv; |
835 | 835 | ||
836 | /* | 836 | /* |
837 | * retrieve search result | 837 | * retrieve search result |
838 | * | 838 | * |
839 | * dtSearch() returns (leaf page pinned, index at which to insert). | 839 | * dtSearch() returns (leaf page pinned, index at which to insert). |
840 | * n.b. dtSearch() may return index of (maxindex + 1) of | 840 | * n.b. dtSearch() may return index of (maxindex + 1) of |
@@ -843,7 +843,7 @@ int dtInsert(tid_t tid, struct inode *ip, | |||
843 | DT_GETSEARCH(ip, btstack->top, bn, mp, p, index); | 843 | DT_GETSEARCH(ip, btstack->top, bn, mp, p, index); |
844 | 844 | ||
845 | /* | 845 | /* |
846 | * insert entry for new key | 846 | * insert entry for new key |
847 | */ | 847 | */ |
848 | if (DO_INDEX(ip)) { | 848 | if (DO_INDEX(ip)) { |
849 | if (JFS_IP(ip)->next_index == DIREND) { | 849 | if (JFS_IP(ip)->next_index == DIREND) { |
@@ -860,9 +860,9 @@ int dtInsert(tid_t tid, struct inode *ip, | |||
860 | data.leaf.ino = *fsn; | 860 | data.leaf.ino = *fsn; |
861 | 861 | ||
862 | /* | 862 | /* |
863 | * leaf page does not have enough room for new entry: | 863 | * leaf page does not have enough room for new entry: |
864 | * | 864 | * |
865 | * extend/split the leaf page; | 865 | * extend/split the leaf page; |
866 | * | 866 | * |
867 | * dtSplitUp() will insert the entry and unpin the leaf page. | 867 | * dtSplitUp() will insert the entry and unpin the leaf page. |
868 | */ | 868 | */ |
@@ -877,9 +877,9 @@ int dtInsert(tid_t tid, struct inode *ip, | |||
877 | } | 877 | } |
878 | 878 | ||
879 | /* | 879 | /* |
880 | * leaf page does have enough room for new entry: | 880 | * leaf page does have enough room for new entry: |
881 | * | 881 | * |
882 | * insert the new data entry into the leaf page; | 882 | * insert the new data entry into the leaf page; |
883 | */ | 883 | */ |
884 | BT_MARK_DIRTY(mp, ip); | 884 | BT_MARK_DIRTY(mp, ip); |
885 | /* | 885 | /* |
@@ -967,13 +967,13 @@ static int dtSplitUp(tid_t tid, | |||
967 | } | 967 | } |
968 | 968 | ||
969 | /* | 969 | /* |
970 | * split leaf page | 970 | * split leaf page |
971 | * | 971 | * |
972 | * The split routines insert the new entry, and | 972 | * The split routines insert the new entry, and |
973 | * acquire txLock as appropriate. | 973 | * acquire txLock as appropriate. |
974 | */ | 974 | */ |
975 | /* | 975 | /* |
976 | * split root leaf page: | 976 | * split root leaf page: |
977 | */ | 977 | */ |
978 | if (sp->header.flag & BT_ROOT) { | 978 | if (sp->header.flag & BT_ROOT) { |
979 | /* | 979 | /* |
@@ -1012,7 +1012,7 @@ static int dtSplitUp(tid_t tid, | |||
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | /* | 1014 | /* |
1015 | * extend first leaf page | 1015 | * extend first leaf page |
1016 | * | 1016 | * |
1017 | * extend the 1st extent if less than buffer page size | 1017 | * extend the 1st extent if less than buffer page size |
1018 | * (dtExtendPage() reurns leaf page unpinned) | 1018 | * (dtExtendPage() reurns leaf page unpinned) |
@@ -1068,7 +1068,7 @@ static int dtSplitUp(tid_t tid, | |||
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | /* | 1070 | /* |
1071 | * split leaf page <sp> into <sp> and a new right page <rp>. | 1071 | * split leaf page <sp> into <sp> and a new right page <rp>. |
1072 | * | 1072 | * |
1073 | * return <rp> pinned and its extent descriptor <rpxd> | 1073 | * return <rp> pinned and its extent descriptor <rpxd> |
1074 | */ | 1074 | */ |
@@ -1433,7 +1433,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, | |||
1433 | rp->header.freecnt = rp->header.maxslot - fsi; | 1433 | rp->header.freecnt = rp->header.maxslot - fsi; |
1434 | 1434 | ||
1435 | /* | 1435 | /* |
1436 | * sequential append at tail: append without split | 1436 | * sequential append at tail: append without split |
1437 | * | 1437 | * |
1438 | * If splitting the last page on a level because of appending | 1438 | * If splitting the last page on a level because of appending |
1439 | * a entry to it (skip is maxentry), it's likely that the access is | 1439 | * a entry to it (skip is maxentry), it's likely that the access is |
@@ -1467,7 +1467,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, | |||
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | /* | 1469 | /* |
1470 | * non-sequential insert (at possibly middle page) | 1470 | * non-sequential insert (at possibly middle page) |
1471 | */ | 1471 | */ |
1472 | 1472 | ||
1473 | /* | 1473 | /* |
@@ -1508,7 +1508,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, | |||
1508 | left = 0; | 1508 | left = 0; |
1509 | 1509 | ||
1510 | /* | 1510 | /* |
1511 | * compute fill factor for split pages | 1511 | * compute fill factor for split pages |
1512 | * | 1512 | * |
1513 | * <nxt> traces the next entry to move to rp | 1513 | * <nxt> traces the next entry to move to rp |
1514 | * <off> traces the next entry to stay in sp | 1514 | * <off> traces the next entry to stay in sp |
@@ -1551,7 +1551,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, | |||
1551 | /* <nxt> poins to the 1st entry to move */ | 1551 | /* <nxt> poins to the 1st entry to move */ |
1552 | 1552 | ||
1553 | /* | 1553 | /* |
1554 | * move entries to right page | 1554 | * move entries to right page |
1555 | * | 1555 | * |
1556 | * dtMoveEntry() initializes rp and reserves entry for insertion | 1556 | * dtMoveEntry() initializes rp and reserves entry for insertion |
1557 | * | 1557 | * |
@@ -1677,7 +1677,7 @@ static int dtExtendPage(tid_t tid, | |||
1677 | return (rc); | 1677 | return (rc); |
1678 | 1678 | ||
1679 | /* | 1679 | /* |
1680 | * extend the extent | 1680 | * extend the extent |
1681 | */ | 1681 | */ |
1682 | pxdlist = split->pxdlist; | 1682 | pxdlist = split->pxdlist; |
1683 | pxd = &pxdlist->pxd[pxdlist->npxd]; | 1683 | pxd = &pxdlist->pxd[pxdlist->npxd]; |
@@ -1722,7 +1722,7 @@ static int dtExtendPage(tid_t tid, | |||
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | /* | 1724 | /* |
1725 | * extend the page | 1725 | * extend the page |
1726 | */ | 1726 | */ |
1727 | sp->header.self = *pxd; | 1727 | sp->header.self = *pxd; |
1728 | 1728 | ||
@@ -1739,9 +1739,6 @@ static int dtExtendPage(tid_t tid, | |||
1739 | /* update buffer extent descriptor of extended page */ | 1739 | /* update buffer extent descriptor of extended page */ |
1740 | xlen = lengthPXD(pxd); | 1740 | xlen = lengthPXD(pxd); |
1741 | xsize = xlen << JFS_SBI(sb)->l2bsize; | 1741 | xsize = xlen << JFS_SBI(sb)->l2bsize; |
1742 | #ifdef _STILL_TO_PORT | ||
1743 | bmSetXD(smp, xaddr, xsize); | ||
1744 | #endif /* _STILL_TO_PORT */ | ||
1745 | 1742 | ||
1746 | /* | 1743 | /* |
1747 | * copy old stbl to new stbl at start of extended area | 1744 | * copy old stbl to new stbl at start of extended area |
@@ -1836,7 +1833,7 @@ static int dtExtendPage(tid_t tid, | |||
1836 | } | 1833 | } |
1837 | 1834 | ||
1838 | /* | 1835 | /* |
1839 | * update parent entry on the parent/root page | 1836 | * update parent entry on the parent/root page |
1840 | */ | 1837 | */ |
1841 | /* | 1838 | /* |
1842 | * acquire a transaction lock on the parent/root page | 1839 | * acquire a transaction lock on the parent/root page |
@@ -1904,7 +1901,7 @@ static int dtSplitRoot(tid_t tid, | |||
1904 | sp = &JFS_IP(ip)->i_dtroot; | 1901 | sp = &JFS_IP(ip)->i_dtroot; |
1905 | 1902 | ||
1906 | /* | 1903 | /* |
1907 | * allocate/initialize a single (right) child page | 1904 | * allocate/initialize a single (right) child page |
1908 | * | 1905 | * |
1909 | * N.B. at first split, a one (or two) block to fit new entry | 1906 | * N.B. at first split, a one (or two) block to fit new entry |
1910 | * is allocated; at subsequent split, a full page is allocated; | 1907 | * is allocated; at subsequent split, a full page is allocated; |
@@ -1943,7 +1940,7 @@ static int dtSplitRoot(tid_t tid, | |||
1943 | rp->header.prev = 0; | 1940 | rp->header.prev = 0; |
1944 | 1941 | ||
1945 | /* | 1942 | /* |
1946 | * move in-line root page into new right page extent | 1943 | * move in-line root page into new right page extent |
1947 | */ | 1944 | */ |
1948 | /* linelock header + copied entries + new stbl (1st slot) in new page */ | 1945 | /* linelock header + copied entries + new stbl (1st slot) in new page */ |
1949 | ASSERT(dtlck->index == 0); | 1946 | ASSERT(dtlck->index == 0); |
@@ -2016,7 +2013,7 @@ static int dtSplitRoot(tid_t tid, | |||
2016 | dtInsertEntry(rp, split->index, split->key, split->data, &dtlck); | 2013 | dtInsertEntry(rp, split->index, split->key, split->data, &dtlck); |
2017 | 2014 | ||
2018 | /* | 2015 | /* |
2019 | * reset parent/root page | 2016 | * reset parent/root page |
2020 | * | 2017 | * |
2021 | * set the 1st entry offset to 0, which force the left-most key | 2018 | * set the 1st entry offset to 0, which force the left-most key |
2022 | * at any level of the tree to be less than any search key. | 2019 | * at any level of the tree to be less than any search key. |
@@ -2102,7 +2099,7 @@ int dtDelete(tid_t tid, | |||
2102 | dtpage_t *np; | 2099 | dtpage_t *np; |
2103 | 2100 | ||
2104 | /* | 2101 | /* |
2105 | * search for the entry to delete: | 2102 | * search for the entry to delete: |
2106 | * | 2103 | * |
2107 | * dtSearch() returns (leaf page pinned, index at which to delete). | 2104 | * dtSearch() returns (leaf page pinned, index at which to delete). |
2108 | */ | 2105 | */ |
@@ -2253,7 +2250,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, | |||
2253 | int i; | 2250 | int i; |
2254 | 2251 | ||
2255 | /* | 2252 | /* |
2256 | * keep the root leaf page which has become empty | 2253 | * keep the root leaf page which has become empty |
2257 | */ | 2254 | */ |
2258 | if (BT_IS_ROOT(fmp)) { | 2255 | if (BT_IS_ROOT(fmp)) { |
2259 | /* | 2256 | /* |
@@ -2269,7 +2266,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, | |||
2269 | } | 2266 | } |
2270 | 2267 | ||
2271 | /* | 2268 | /* |
2272 | * free the non-root leaf page | 2269 | * free the non-root leaf page |
2273 | */ | 2270 | */ |
2274 | /* | 2271 | /* |
2275 | * acquire a transaction lock on the page | 2272 | * acquire a transaction lock on the page |
@@ -2299,7 +2296,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, | |||
2299 | discard_metapage(fmp); | 2296 | discard_metapage(fmp); |
2300 | 2297 | ||
2301 | /* | 2298 | /* |
2302 | * propagate page deletion up the directory tree | 2299 | * propagate page deletion up the directory tree |
2303 | * | 2300 | * |
2304 | * If the delete from the parent page makes it empty, | 2301 | * If the delete from the parent page makes it empty, |
2305 | * continue all the way up the tree. | 2302 | * continue all the way up the tree. |
@@ -2440,10 +2437,10 @@ static int dtDeleteUp(tid_t tid, struct inode *ip, | |||
2440 | 2437 | ||
2441 | #ifdef _NOTYET | 2438 | #ifdef _NOTYET |
2442 | /* | 2439 | /* |
2443 | * NAME: dtRelocate() | 2440 | * NAME: dtRelocate() |
2444 | * | 2441 | * |
2445 | * FUNCTION: relocate dtpage (internal or leaf) of directory; | 2442 | * FUNCTION: relocate dtpage (internal or leaf) of directory; |
2446 | * This function is mainly used by defragfs utility. | 2443 | * This function is mainly used by defragfs utility. |
2447 | */ | 2444 | */ |
2448 | int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | 2445 | int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, |
2449 | s64 nxaddr) | 2446 | s64 nxaddr) |
@@ -2471,8 +2468,8 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2471 | xlen); | 2468 | xlen); |
2472 | 2469 | ||
2473 | /* | 2470 | /* |
2474 | * 1. get the internal parent dtpage covering | 2471 | * 1. get the internal parent dtpage covering |
2475 | * router entry for the tartget page to be relocated; | 2472 | * router entry for the tartget page to be relocated; |
2476 | */ | 2473 | */ |
2477 | rc = dtSearchNode(ip, lmxaddr, opxd, &btstack); | 2474 | rc = dtSearchNode(ip, lmxaddr, opxd, &btstack); |
2478 | if (rc) | 2475 | if (rc) |
@@ -2483,7 +2480,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2483 | jfs_info("dtRelocate: parent router entry validated."); | 2480 | jfs_info("dtRelocate: parent router entry validated."); |
2484 | 2481 | ||
2485 | /* | 2482 | /* |
2486 | * 2. relocate the target dtpage | 2483 | * 2. relocate the target dtpage |
2487 | */ | 2484 | */ |
2488 | /* read in the target page from src extent */ | 2485 | /* read in the target page from src extent */ |
2489 | DT_GETPAGE(ip, oxaddr, mp, PSIZE, p, rc); | 2486 | DT_GETPAGE(ip, oxaddr, mp, PSIZE, p, rc); |
@@ -2581,9 +2578,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2581 | 2578 | ||
2582 | /* update the buffer extent descriptor of the dtpage */ | 2579 | /* update the buffer extent descriptor of the dtpage */ |
2583 | xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize; | 2580 | xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize; |
2584 | #ifdef _STILL_TO_PORT | 2581 | |
2585 | bmSetXD(mp, nxaddr, xsize); | ||
2586 | #endif /* _STILL_TO_PORT */ | ||
2587 | /* unpin the relocated page */ | 2582 | /* unpin the relocated page */ |
2588 | DT_PUTPAGE(mp); | 2583 | DT_PUTPAGE(mp); |
2589 | jfs_info("dtRelocate: target dtpage relocated."); | 2584 | jfs_info("dtRelocate: target dtpage relocated."); |
@@ -2594,7 +2589,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2594 | */ | 2589 | */ |
2595 | 2590 | ||
2596 | /* | 2591 | /* |
2597 | * 3. acquire maplock for the source extent to be freed; | 2592 | * 3. acquire maplock for the source extent to be freed; |
2598 | */ | 2593 | */ |
2599 | /* for dtpage relocation, write a LOG_NOREDOPAGE record | 2594 | /* for dtpage relocation, write a LOG_NOREDOPAGE record |
2600 | * for the source dtpage (logredo() will init NoRedoPage | 2595 | * for the source dtpage (logredo() will init NoRedoPage |
@@ -2609,7 +2604,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2609 | pxdlock->index = 1; | 2604 | pxdlock->index = 1; |
2610 | 2605 | ||
2611 | /* | 2606 | /* |
2612 | * 4. update the parent router entry for relocation; | 2607 | * 4. update the parent router entry for relocation; |
2613 | * | 2608 | * |
2614 | * acquire tlck for the parent entry covering the target dtpage; | 2609 | * acquire tlck for the parent entry covering the target dtpage; |
2615 | * write LOG_REDOPAGE to apply after image only; | 2610 | * write LOG_REDOPAGE to apply after image only; |
@@ -2637,7 +2632,7 @@ int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, | |||
2637 | * NAME: dtSearchNode() | 2632 | * NAME: dtSearchNode() |
2638 | * | 2633 | * |
2639 | * FUNCTION: Search for an dtpage containing a specified address | 2634 | * FUNCTION: Search for an dtpage containing a specified address |
2640 | * This function is mainly used by defragfs utility. | 2635 | * This function is mainly used by defragfs utility. |
2641 | * | 2636 | * |
2642 | * NOTE: Search result on stack, the found page is pinned at exit. | 2637 | * NOTE: Search result on stack, the found page is pinned at exit. |
2643 | * The result page must be an internal dtpage. | 2638 | * The result page must be an internal dtpage. |
@@ -2660,7 +2655,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd, | |||
2660 | BT_CLR(btstack); /* reset stack */ | 2655 | BT_CLR(btstack); /* reset stack */ |
2661 | 2656 | ||
2662 | /* | 2657 | /* |
2663 | * descend tree to the level with specified leftmost page | 2658 | * descend tree to the level with specified leftmost page |
2664 | * | 2659 | * |
2665 | * by convention, root bn = 0. | 2660 | * by convention, root bn = 0. |
2666 | */ | 2661 | */ |
@@ -2699,7 +2694,7 @@ static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd, | |||
2699 | } | 2694 | } |
2700 | 2695 | ||
2701 | /* | 2696 | /* |
2702 | * search each page at the current levevl | 2697 | * search each page at the current levevl |
2703 | */ | 2698 | */ |
2704 | loop: | 2699 | loop: |
2705 | stbl = DT_GETSTBL(p); | 2700 | stbl = DT_GETSTBL(p); |
@@ -3044,9 +3039,9 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3044 | if (DO_INDEX(ip)) { | 3039 | if (DO_INDEX(ip)) { |
3045 | /* | 3040 | /* |
3046 | * persistent index is stored in directory entries. | 3041 | * persistent index is stored in directory entries. |
3047 | * Special cases: 0 = . | 3042 | * Special cases: 0 = . |
3048 | * 1 = .. | 3043 | * 1 = .. |
3049 | * -1 = End of directory | 3044 | * -1 = End of directory |
3050 | */ | 3045 | */ |
3051 | do_index = 1; | 3046 | do_index = 1; |
3052 | 3047 | ||
@@ -3128,10 +3123,10 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3128 | /* | 3123 | /* |
3129 | * Legacy filesystem - OS/2 & Linux JFS < 0.3.6 | 3124 | * Legacy filesystem - OS/2 & Linux JFS < 0.3.6 |
3130 | * | 3125 | * |
3131 | * pn = index = 0: First entry "." | 3126 | * pn = index = 0: First entry "." |
3132 | * pn = 0; index = 1: Second entry ".." | 3127 | * pn = 0; index = 1: Second entry ".." |
3133 | * pn > 0: Real entries, pn=1 -> leftmost page | 3128 | * pn > 0: Real entries, pn=1 -> leftmost page |
3134 | * pn = index = -1: No more entries | 3129 | * pn = index = -1: No more entries |
3135 | */ | 3130 | */ |
3136 | dtpos = filp->f_pos; | 3131 | dtpos = filp->f_pos; |
3137 | if (dtpos == 0) { | 3132 | if (dtpos == 0) { |
@@ -3351,7 +3346,7 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack) | |||
3351 | BT_CLR(btstack); /* reset stack */ | 3346 | BT_CLR(btstack); /* reset stack */ |
3352 | 3347 | ||
3353 | /* | 3348 | /* |
3354 | * descend leftmost path of the tree | 3349 | * descend leftmost path of the tree |
3355 | * | 3350 | * |
3356 | * by convention, root bn = 0. | 3351 | * by convention, root bn = 0. |
3357 | */ | 3352 | */ |
@@ -4531,7 +4526,7 @@ int dtModify(tid_t tid, struct inode *ip, | |||
4531 | struct ldtentry *entry; | 4526 | struct ldtentry *entry; |
4532 | 4527 | ||
4533 | /* | 4528 | /* |
4534 | * search for the entry to modify: | 4529 | * search for the entry to modify: |
4535 | * | 4530 | * |
4536 | * dtSearch() returns (leaf page pinned, index at which to modify). | 4531 | * dtSearch() returns (leaf page pinned, index at which to modify). |
4537 | */ | 4532 | */ |
diff --git a/fs/jfs/jfs_dtree.h b/fs/jfs/jfs_dtree.h index af8513f78648..8561c6ecece0 100644 --- a/fs/jfs/jfs_dtree.h +++ b/fs/jfs/jfs_dtree.h | |||
@@ -35,7 +35,7 @@ typedef union { | |||
35 | 35 | ||
36 | 36 | ||
37 | /* | 37 | /* |
38 | * entry segment/slot | 38 | * entry segment/slot |
39 | * | 39 | * |
40 | * an entry consists of type dependent head/only segment/slot and | 40 | * an entry consists of type dependent head/only segment/slot and |
41 | * additional segments/slots linked vi next field; | 41 | * additional segments/slots linked vi next field; |
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index a35bdca6a805..7ae1e3281de9 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c | |||
@@ -34,8 +34,8 @@ static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *); | |||
34 | #endif | 34 | #endif |
35 | static s64 extRoundDown(s64 nb); | 35 | static s64 extRoundDown(s64 nb); |
36 | 36 | ||
37 | #define DPD(a) (printk("(a): %d\n",(a))) | 37 | #define DPD(a) (printk("(a): %d\n",(a))) |
38 | #define DPC(a) (printk("(a): %c\n",(a))) | 38 | #define DPC(a) (printk("(a): %c\n",(a))) |
39 | #define DPL1(a) \ | 39 | #define DPL1(a) \ |
40 | { \ | 40 | { \ |
41 | if ((a) >> 32) \ | 41 | if ((a) >> 32) \ |
@@ -51,19 +51,19 @@ static s64 extRoundDown(s64 nb); | |||
51 | printk("(a): %x\n",(a) << 32); \ | 51 | printk("(a): %x\n",(a) << 32); \ |
52 | } | 52 | } |
53 | 53 | ||
54 | #define DPD1(a) (printk("(a): %d ",(a))) | 54 | #define DPD1(a) (printk("(a): %d ",(a))) |
55 | #define DPX(a) (printk("(a): %08x\n",(a))) | 55 | #define DPX(a) (printk("(a): %08x\n",(a))) |
56 | #define DPX1(a) (printk("(a): %08x ",(a))) | 56 | #define DPX1(a) (printk("(a): %08x ",(a))) |
57 | #define DPS(a) (printk("%s\n",(a))) | 57 | #define DPS(a) (printk("%s\n",(a))) |
58 | #define DPE(a) (printk("\nENTERING: %s\n",(a))) | 58 | #define DPE(a) (printk("\nENTERING: %s\n",(a))) |
59 | #define DPE1(a) (printk("\nENTERING: %s",(a))) | 59 | #define DPE1(a) (printk("\nENTERING: %s",(a))) |
60 | #define DPS1(a) (printk(" %s ",(a))) | 60 | #define DPS1(a) (printk(" %s ",(a))) |
61 | 61 | ||
62 | 62 | ||
63 | /* | 63 | /* |
64 | * NAME: extAlloc() | 64 | * NAME: extAlloc() |
65 | * | 65 | * |
66 | * FUNCTION: allocate an extent for a specified page range within a | 66 | * FUNCTION: allocate an extent for a specified page range within a |
67 | * file. | 67 | * file. |
68 | * | 68 | * |
69 | * PARAMETERS: | 69 | * PARAMETERS: |
@@ -78,9 +78,9 @@ static s64 extRoundDown(s64 nb); | |||
78 | * should be marked as allocated but not recorded. | 78 | * should be marked as allocated but not recorded. |
79 | * | 79 | * |
80 | * RETURN VALUES: | 80 | * RETURN VALUES: |
81 | * 0 - success | 81 | * 0 - success |
82 | * -EIO - i/o error. | 82 | * -EIO - i/o error. |
83 | * -ENOSPC - insufficient disk resources. | 83 | * -ENOSPC - insufficient disk resources. |
84 | */ | 84 | */ |
85 | int | 85 | int |
86 | extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) | 86 | extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) |
@@ -192,9 +192,9 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) | |||
192 | 192 | ||
193 | #ifdef _NOTYET | 193 | #ifdef _NOTYET |
194 | /* | 194 | /* |
195 | * NAME: extRealloc() | 195 | * NAME: extRealloc() |
196 | * | 196 | * |
197 | * FUNCTION: extend the allocation of a file extent containing a | 197 | * FUNCTION: extend the allocation of a file extent containing a |
198 | * partial back last page. | 198 | * partial back last page. |
199 | * | 199 | * |
200 | * PARAMETERS: | 200 | * PARAMETERS: |
@@ -207,9 +207,9 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) | |||
207 | * should be marked as allocated but not recorded. | 207 | * should be marked as allocated but not recorded. |
208 | * | 208 | * |
209 | * RETURN VALUES: | 209 | * RETURN VALUES: |
210 | * 0 - success | 210 | * 0 - success |
211 | * -EIO - i/o error. | 211 | * -EIO - i/o error. |
212 | * -ENOSPC - insufficient disk resources. | 212 | * -ENOSPC - insufficient disk resources. |
213 | */ | 213 | */ |
214 | int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) | 214 | int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) |
215 | { | 215 | { |
@@ -345,9 +345,9 @@ exit: | |||
345 | 345 | ||
346 | 346 | ||
347 | /* | 347 | /* |
348 | * NAME: extHint() | 348 | * NAME: extHint() |
349 | * | 349 | * |
350 | * FUNCTION: produce an extent allocation hint for a file offset. | 350 | * FUNCTION: produce an extent allocation hint for a file offset. |
351 | * | 351 | * |
352 | * PARAMETERS: | 352 | * PARAMETERS: |
353 | * ip - the inode of the file. | 353 | * ip - the inode of the file. |
@@ -356,8 +356,8 @@ exit: | |||
356 | * the hint. | 356 | * the hint. |
357 | * | 357 | * |
358 | * RETURN VALUES: | 358 | * RETURN VALUES: |
359 | * 0 - success | 359 | * 0 - success |
360 | * -EIO - i/o error. | 360 | * -EIO - i/o error. |
361 | */ | 361 | */ |
362 | int extHint(struct inode *ip, s64 offset, xad_t * xp) | 362 | int extHint(struct inode *ip, s64 offset, xad_t * xp) |
363 | { | 363 | { |
@@ -387,7 +387,7 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) | |||
387 | lxdl.nlxd = 1; | 387 | lxdl.nlxd = 1; |
388 | lxdl.lxd = &lxd; | 388 | lxdl.lxd = &lxd; |
389 | LXDoffset(&lxd, prev) | 389 | LXDoffset(&lxd, prev) |
390 | LXDlength(&lxd, nbperpage); | 390 | LXDlength(&lxd, nbperpage); |
391 | 391 | ||
392 | xadl.maxnxad = 1; | 392 | xadl.maxnxad = 1; |
393 | xadl.nxad = 0; | 393 | xadl.nxad = 0; |
@@ -397,11 +397,11 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) | |||
397 | if ((rc = xtLookupList(ip, &lxdl, &xadl, 0))) | 397 | if ((rc = xtLookupList(ip, &lxdl, &xadl, 0))) |
398 | return (rc); | 398 | return (rc); |
399 | 399 | ||
400 | /* check if not extent exists for the previous page. | 400 | /* check if no extent exists for the previous page. |
401 | * this is possible for sparse files. | 401 | * this is possible for sparse files. |
402 | */ | 402 | */ |
403 | if (xadl.nxad == 0) { | 403 | if (xadl.nxad == 0) { |
404 | // assert(ISSPARSE(ip)); | 404 | // assert(ISSPARSE(ip)); |
405 | return (0); | 405 | return (0); |
406 | } | 406 | } |
407 | 407 | ||
@@ -410,28 +410,28 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) | |||
410 | */ | 410 | */ |
411 | xp->flag &= XAD_NOTRECORDED; | 411 | xp->flag &= XAD_NOTRECORDED; |
412 | 412 | ||
413 | if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) { | 413 | if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) { |
414 | jfs_error(ip->i_sb, "extHint: corrupt xtree"); | 414 | jfs_error(ip->i_sb, "extHint: corrupt xtree"); |
415 | return -EIO; | 415 | return -EIO; |
416 | } | 416 | } |
417 | 417 | ||
418 | return (0); | 418 | return (0); |
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
422 | /* | 422 | /* |
423 | * NAME: extRecord() | 423 | * NAME: extRecord() |
424 | * | 424 | * |
425 | * FUNCTION: change a page with a file from not recorded to recorded. | 425 | * FUNCTION: change a page with a file from not recorded to recorded. |
426 | * | 426 | * |
427 | * PARAMETERS: | 427 | * PARAMETERS: |
428 | * ip - inode of the file. | 428 | * ip - inode of the file. |
429 | * cp - cbuf of the file page. | 429 | * cp - cbuf of the file page. |
430 | * | 430 | * |
431 | * RETURN VALUES: | 431 | * RETURN VALUES: |
432 | * 0 - success | 432 | * 0 - success |
433 | * -EIO - i/o error. | 433 | * -EIO - i/o error. |
434 | * -ENOSPC - insufficient disk resources. | 434 | * -ENOSPC - insufficient disk resources. |
435 | */ | 435 | */ |
436 | int extRecord(struct inode *ip, xad_t * xp) | 436 | int extRecord(struct inode *ip, xad_t * xp) |
437 | { | 437 | { |
@@ -451,9 +451,9 @@ int extRecord(struct inode *ip, xad_t * xp) | |||
451 | 451 | ||
452 | #ifdef _NOTYET | 452 | #ifdef _NOTYET |
453 | /* | 453 | /* |
454 | * NAME: extFill() | 454 | * NAME: extFill() |
455 | * | 455 | * |
456 | * FUNCTION: allocate disk space for a file page that represents | 456 | * FUNCTION: allocate disk space for a file page that represents |
457 | * a file hole. | 457 | * a file hole. |
458 | * | 458 | * |
459 | * PARAMETERS: | 459 | * PARAMETERS: |
@@ -461,16 +461,16 @@ int extRecord(struct inode *ip, xad_t * xp) | |||
461 | * cp - cbuf of the file page represent the hole. | 461 | * cp - cbuf of the file page represent the hole. |
462 | * | 462 | * |
463 | * RETURN VALUES: | 463 | * RETURN VALUES: |
464 | * 0 - success | 464 | * 0 - success |
465 | * -EIO - i/o error. | 465 | * -EIO - i/o error. |
466 | * -ENOSPC - insufficient disk resources. | 466 | * -ENOSPC - insufficient disk resources. |
467 | */ | 467 | */ |
468 | int extFill(struct inode *ip, xad_t * xp) | 468 | int extFill(struct inode *ip, xad_t * xp) |
469 | { | 469 | { |
470 | int rc, nbperpage = JFS_SBI(ip->i_sb)->nbperpage; | 470 | int rc, nbperpage = JFS_SBI(ip->i_sb)->nbperpage; |
471 | s64 blkno = offsetXAD(xp) >> ip->i_blkbits; | 471 | s64 blkno = offsetXAD(xp) >> ip->i_blkbits; |
472 | 472 | ||
473 | // assert(ISSPARSE(ip)); | 473 | // assert(ISSPARSE(ip)); |
474 | 474 | ||
475 | /* initialize the extent allocation hint */ | 475 | /* initialize the extent allocation hint */ |
476 | XADaddress(xp, 0); | 476 | XADaddress(xp, 0); |
@@ -489,7 +489,7 @@ int extFill(struct inode *ip, xad_t * xp) | |||
489 | /* | 489 | /* |
490 | * NAME: extBalloc() | 490 | * NAME: extBalloc() |
491 | * | 491 | * |
492 | * FUNCTION: allocate disk blocks to form an extent. | 492 | * FUNCTION: allocate disk blocks to form an extent. |
493 | * | 493 | * |
494 | * initially, we will try to allocate disk blocks for the | 494 | * initially, we will try to allocate disk blocks for the |
495 | * requested size (nblocks). if this fails (nblocks | 495 | * requested size (nblocks). if this fails (nblocks |
@@ -513,9 +513,9 @@ int extFill(struct inode *ip, xad_t * xp) | |||
513 | * allocated block range. | 513 | * allocated block range. |
514 | * | 514 | * |
515 | * RETURN VALUES: | 515 | * RETURN VALUES: |
516 | * 0 - success | 516 | * 0 - success |
517 | * -EIO - i/o error. | 517 | * -EIO - i/o error. |
518 | * -ENOSPC - insufficient disk resources. | 518 | * -ENOSPC - insufficient disk resources. |
519 | */ | 519 | */ |
520 | static int | 520 | static int |
521 | extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) | 521 | extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) |
@@ -580,7 +580,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) | |||
580 | /* | 580 | /* |
581 | * NAME: extBrealloc() | 581 | * NAME: extBrealloc() |
582 | * | 582 | * |
583 | * FUNCTION: attempt to extend an extent's allocation. | 583 | * FUNCTION: attempt to extend an extent's allocation. |
584 | * | 584 | * |
585 | * Initially, we will try to extend the extent's allocation | 585 | * Initially, we will try to extend the extent's allocation |
586 | * in place. If this fails, we'll try to move the extent | 586 | * in place. If this fails, we'll try to move the extent |
@@ -597,8 +597,8 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) | |||
597 | * | 597 | * |
598 | * PARAMETERS: | 598 | * PARAMETERS: |
599 | * ip - the inode of the file. | 599 | * ip - the inode of the file. |
600 | * blkno - starting block number of the extents current allocation. | 600 | * blkno - starting block number of the extents current allocation. |
601 | * nblks - number of blocks within the extents current allocation. | 601 | * nblks - number of blocks within the extents current allocation. |
602 | * newnblks - pointer to a s64 value. on entry, this value is the | 602 | * newnblks - pointer to a s64 value. on entry, this value is the |
603 | * the new desired extent size (number of blocks). on | 603 | * the new desired extent size (number of blocks). on |
604 | * successful exit, this value is set to the extent's actual | 604 | * successful exit, this value is set to the extent's actual |
@@ -606,9 +606,9 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno) | |||
606 | * newblkno - the starting block number of the extents new allocation. | 606 | * newblkno - the starting block number of the extents new allocation. |
607 | * | 607 | * |
608 | * RETURN VALUES: | 608 | * RETURN VALUES: |
609 | * 0 - success | 609 | * 0 - success |
610 | * -EIO - i/o error. | 610 | * -EIO - i/o error. |
611 | * -ENOSPC - insufficient disk resources. | 611 | * -ENOSPC - insufficient disk resources. |
612 | */ | 612 | */ |
613 | static int | 613 | static int |
614 | extBrealloc(struct inode *ip, | 614 | extBrealloc(struct inode *ip, |
@@ -634,16 +634,16 @@ extBrealloc(struct inode *ip, | |||
634 | 634 | ||
635 | 635 | ||
636 | /* | 636 | /* |
637 | * NAME: extRoundDown() | 637 | * NAME: extRoundDown() |
638 | * | 638 | * |
639 | * FUNCTION: round down a specified number of blocks to the next | 639 | * FUNCTION: round down a specified number of blocks to the next |
640 | * smallest power of 2 number. | 640 | * smallest power of 2 number. |
641 | * | 641 | * |
642 | * PARAMETERS: | 642 | * PARAMETERS: |
643 | * nb - the inode of the file. | 643 | * nb - the inode of the file. |
644 | * | 644 | * |
645 | * RETURN VALUES: | 645 | * RETURN VALUES: |
646 | * next smallest power of 2 number. | 646 | * next smallest power of 2 number. |
647 | */ | 647 | */ |
648 | static s64 extRoundDown(s64 nb) | 648 | static s64 extRoundDown(s64 nb) |
649 | { | 649 | { |
diff --git a/fs/jfs/jfs_filsys.h b/fs/jfs/jfs_filsys.h index 38f70ac03bec..b3f5463fbe52 100644 --- a/fs/jfs/jfs_filsys.h +++ b/fs/jfs/jfs_filsys.h | |||
@@ -34,9 +34,9 @@ | |||
34 | #define JFS_UNICODE 0x00000001 /* unicode name */ | 34 | #define JFS_UNICODE 0x00000001 /* unicode name */ |
35 | 35 | ||
36 | /* mount time flags for error handling */ | 36 | /* mount time flags for error handling */ |
37 | #define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */ | 37 | #define JFS_ERR_REMOUNT_RO 0x00000002 /* remount read-only */ |
38 | #define JFS_ERR_CONTINUE 0x00000004 /* continue */ | 38 | #define JFS_ERR_CONTINUE 0x00000004 /* continue */ |
39 | #define JFS_ERR_PANIC 0x00000008 /* panic */ | 39 | #define JFS_ERR_PANIC 0x00000008 /* panic */ |
40 | 40 | ||
41 | /* Quota support */ | 41 | /* Quota support */ |
42 | #define JFS_USRQUOTA 0x00000010 | 42 | #define JFS_USRQUOTA 0x00000010 |
@@ -83,7 +83,6 @@ | |||
83 | /* case-insensitive name/directory support */ | 83 | /* case-insensitive name/directory support */ |
84 | 84 | ||
85 | #define JFS_AIX 0x80000000 /* AIX support */ | 85 | #define JFS_AIX 0x80000000 /* AIX support */ |
86 | /* POSIX name/directory support - Never implemented*/ | ||
87 | 86 | ||
88 | /* | 87 | /* |
89 | * buffer cache configuration | 88 | * buffer cache configuration |
@@ -113,10 +112,10 @@ | |||
113 | #define IDATASIZE 256 /* inode inline data size */ | 112 | #define IDATASIZE 256 /* inode inline data size */ |
114 | #define IXATTRSIZE 128 /* inode inline extended attribute size */ | 113 | #define IXATTRSIZE 128 /* inode inline extended attribute size */ |
115 | 114 | ||
116 | #define XTPAGE_SIZE 4096 | 115 | #define XTPAGE_SIZE 4096 |
117 | #define log2_PAGESIZE 12 | 116 | #define log2_PAGESIZE 12 |
118 | 117 | ||
119 | #define IAG_SIZE 4096 | 118 | #define IAG_SIZE 4096 |
120 | #define IAG_EXTENT_SIZE 4096 | 119 | #define IAG_EXTENT_SIZE 4096 |
121 | #define INOSPERIAG 4096 /* number of disk inodes per iag */ | 120 | #define INOSPERIAG 4096 /* number of disk inodes per iag */ |
122 | #define L2INOSPERIAG 12 /* l2 number of disk inodes per iag */ | 121 | #define L2INOSPERIAG 12 /* l2 number of disk inodes per iag */ |
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 | { |
diff --git a/fs/jfs/jfs_imap.h b/fs/jfs/jfs_imap.h index 4f9c346ed498..610a0e9d8941 100644 --- a/fs/jfs/jfs_imap.h +++ b/fs/jfs/jfs_imap.h | |||
@@ -24,17 +24,17 @@ | |||
24 | * jfs_imap.h: disk inode manager | 24 | * jfs_imap.h: disk inode manager |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define EXTSPERIAG 128 /* number of disk inode extent per iag */ | 27 | #define EXTSPERIAG 128 /* number of disk inode extent per iag */ |
28 | #define IMAPBLKNO 0 /* lblkno of dinomap within inode map */ | 28 | #define IMAPBLKNO 0 /* lblkno of dinomap within inode map */ |
29 | #define SMAPSZ 4 /* number of words per summary map */ | 29 | #define SMAPSZ 4 /* number of words per summary map */ |
30 | #define EXTSPERSUM 32 /* number of extents per summary map entry */ | 30 | #define EXTSPERSUM 32 /* number of extents per summary map entry */ |
31 | #define L2EXTSPERSUM 5 /* l2 number of extents per summary map */ | 31 | #define L2EXTSPERSUM 5 /* l2 number of extents per summary map */ |
32 | #define PGSPERIEXT 4 /* number of 4K pages per dinode extent */ | 32 | #define PGSPERIEXT 4 /* number of 4K pages per dinode extent */ |
33 | #define MAXIAGS ((1<<20)-1) /* maximum number of iags */ | 33 | #define MAXIAGS ((1<<20)-1) /* maximum number of iags */ |
34 | #define MAXAG 128 /* maximum number of allocation groups */ | 34 | #define MAXAG 128 /* maximum number of allocation groups */ |
35 | 35 | ||
36 | #define AMAPSIZE 512 /* bytes in the IAG allocation maps */ | 36 | #define AMAPSIZE 512 /* bytes in the IAG allocation maps */ |
37 | #define SMAPSIZE 16 /* bytes in the IAG summary maps */ | 37 | #define SMAPSIZE 16 /* bytes in the IAG summary maps */ |
38 | 38 | ||
39 | /* convert inode number to iag number */ | 39 | /* convert inode number to iag number */ |
40 | #define INOTOIAG(ino) ((ino) >> L2INOSPERIAG) | 40 | #define INOTOIAG(ino) ((ino) >> L2INOSPERIAG) |
@@ -60,31 +60,31 @@ | |||
60 | * inode allocation group page (per 4096 inodes of an AG) | 60 | * inode allocation group page (per 4096 inodes of an AG) |
61 | */ | 61 | */ |
62 | struct iag { | 62 | struct iag { |
63 | __le64 agstart; /* 8: starting block of ag */ | 63 | __le64 agstart; /* 8: starting block of ag */ |
64 | __le32 iagnum; /* 4: inode allocation group number */ | 64 | __le32 iagnum; /* 4: inode allocation group number */ |
65 | __le32 inofreefwd; /* 4: ag inode free list forward */ | 65 | __le32 inofreefwd; /* 4: ag inode free list forward */ |
66 | __le32 inofreeback; /* 4: ag inode free list back */ | 66 | __le32 inofreeback; /* 4: ag inode free list back */ |
67 | __le32 extfreefwd; /* 4: ag inode extent free list forward */ | 67 | __le32 extfreefwd; /* 4: ag inode extent free list forward */ |
68 | __le32 extfreeback; /* 4: ag inode extent free list back */ | 68 | __le32 extfreeback; /* 4: ag inode extent free list back */ |
69 | __le32 iagfree; /* 4: iag free list */ | 69 | __le32 iagfree; /* 4: iag free list */ |
70 | 70 | ||
71 | /* summary map: 1 bit per inode extent */ | 71 | /* summary map: 1 bit per inode extent */ |
72 | __le32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes; | 72 | __le32 inosmap[SMAPSZ]; /* 16: sum map of mapwords w/ free inodes; |
73 | * note: this indicates free and backed | 73 | * note: this indicates free and backed |
74 | * inodes, if the extent is not backed the | 74 | * inodes, if the extent is not backed the |
75 | * value will be 1. if the extent is | 75 | * value will be 1. if the extent is |
76 | * backed but all inodes are being used the | 76 | * backed but all inodes are being used the |
77 | * value will be 1. if the extent is | 77 | * value will be 1. if the extent is |
78 | * backed but at least one of the inodes is | 78 | * backed but at least one of the inodes is |
79 | * free the value will be 0. | 79 | * free the value will be 0. |
80 | */ | 80 | */ |
81 | __le32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */ | 81 | __le32 extsmap[SMAPSZ]; /* 16: sum map of mapwords w/ free extents */ |
82 | __le32 nfreeinos; /* 4: number of free inodes */ | 82 | __le32 nfreeinos; /* 4: number of free inodes */ |
83 | __le32 nfreeexts; /* 4: number of free extents */ | 83 | __le32 nfreeexts; /* 4: number of free extents */ |
84 | /* (72) */ | 84 | /* (72) */ |
85 | u8 pad[1976]; /* 1976: pad to 2048 bytes */ | 85 | u8 pad[1976]; /* 1976: pad to 2048 bytes */ |
86 | /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */ | 86 | /* allocation bit map: 1 bit per inode (0 - free, 1 - allocated) */ |
87 | __le32 wmap[EXTSPERIAG]; /* 512: working allocation map */ | 87 | __le32 wmap[EXTSPERIAG]; /* 512: working allocation map */ |
88 | __le32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */ | 88 | __le32 pmap[EXTSPERIAG]; /* 512: persistent allocation map */ |
89 | pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */ | 89 | pxd_t inoext[EXTSPERIAG]; /* 1024: inode extent addresses */ |
90 | }; /* (4096) */ | 90 | }; /* (4096) */ |
@@ -93,44 +93,44 @@ struct iag { | |||
93 | * per AG control information (in inode map control page) | 93 | * per AG control information (in inode map control page) |
94 | */ | 94 | */ |
95 | struct iagctl_disk { | 95 | struct iagctl_disk { |
96 | __le32 inofree; /* 4: free inode list anchor */ | 96 | __le32 inofree; /* 4: free inode list anchor */ |
97 | __le32 extfree; /* 4: free extent list anchor */ | 97 | __le32 extfree; /* 4: free extent list anchor */ |
98 | __le32 numinos; /* 4: number of backed inodes */ | 98 | __le32 numinos; /* 4: number of backed inodes */ |
99 | __le32 numfree; /* 4: number of free inodes */ | 99 | __le32 numfree; /* 4: number of free inodes */ |
100 | }; /* (16) */ | 100 | }; /* (16) */ |
101 | 101 | ||
102 | struct iagctl { | 102 | struct iagctl { |
103 | int inofree; /* free inode list anchor */ | 103 | int inofree; /* free inode list anchor */ |
104 | int extfree; /* free extent list anchor */ | 104 | int extfree; /* free extent list anchor */ |
105 | int numinos; /* number of backed inodes */ | 105 | int numinos; /* number of backed inodes */ |
106 | int numfree; /* number of free inodes */ | 106 | int numfree; /* number of free inodes */ |
107 | }; | 107 | }; |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * per fileset/aggregate inode map control page | 110 | * per fileset/aggregate inode map control page |
111 | */ | 111 | */ |
112 | struct dinomap_disk { | 112 | struct dinomap_disk { |
113 | __le32 in_freeiag; /* 4: free iag list anchor */ | 113 | __le32 in_freeiag; /* 4: free iag list anchor */ |
114 | __le32 in_nextiag; /* 4: next free iag number */ | 114 | __le32 in_nextiag; /* 4: next free iag number */ |
115 | __le32 in_numinos; /* 4: num of backed inodes */ | 115 | __le32 in_numinos; /* 4: num of backed inodes */ |
116 | __le32 in_numfree; /* 4: num of free backed inodes */ | 116 | __le32 in_numfree; /* 4: num of free backed inodes */ |
117 | __le32 in_nbperiext; /* 4: num of blocks per inode extent */ | 117 | __le32 in_nbperiext; /* 4: num of blocks per inode extent */ |
118 | __le32 in_l2nbperiext; /* 4: l2 of in_nbperiext */ | 118 | __le32 in_l2nbperiext; /* 4: l2 of in_nbperiext */ |
119 | __le32 in_diskblock; /* 4: for standalone test driver */ | 119 | __le32 in_diskblock; /* 4: for standalone test driver */ |
120 | __le32 in_maxag; /* 4: for standalone test driver */ | 120 | __le32 in_maxag; /* 4: for standalone test driver */ |
121 | u8 pad[2016]; /* 2016: pad to 2048 */ | 121 | u8 pad[2016]; /* 2016: pad to 2048 */ |
122 | struct iagctl_disk in_agctl[MAXAG]; /* 2048: AG control information */ | 122 | struct iagctl_disk in_agctl[MAXAG]; /* 2048: AG control information */ |
123 | }; /* (4096) */ | 123 | }; /* (4096) */ |
124 | 124 | ||
125 | struct dinomap { | 125 | struct dinomap { |
126 | int in_freeiag; /* free iag list anchor */ | 126 | int in_freeiag; /* free iag list anchor */ |
127 | int in_nextiag; /* next free iag number */ | 127 | int in_nextiag; /* next free iag number */ |
128 | int in_numinos; /* num of backed inodes */ | 128 | int in_numinos; /* num of backed inodes */ |
129 | int in_numfree; /* num of free backed inodes */ | 129 | int in_numfree; /* num of free backed inodes */ |
130 | int in_nbperiext; /* num of blocks per inode extent */ | 130 | int in_nbperiext; /* num of blocks per inode extent */ |
131 | int in_l2nbperiext; /* l2 of in_nbperiext */ | 131 | int in_l2nbperiext; /* l2 of in_nbperiext */ |
132 | int in_diskblock; /* for standalone test driver */ | 132 | int in_diskblock; /* for standalone test driver */ |
133 | int in_maxag; /* for standalone test driver */ | 133 | int in_maxag; /* for standalone test driver */ |
134 | struct iagctl in_agctl[MAXAG]; /* AG control information */ | 134 | struct iagctl in_agctl[MAXAG]; /* AG control information */ |
135 | }; | 135 | }; |
136 | 136 | ||
@@ -139,9 +139,9 @@ struct dinomap { | |||
139 | */ | 139 | */ |
140 | struct inomap { | 140 | struct inomap { |
141 | struct dinomap im_imap; /* 4096: inode allocation control */ | 141 | struct dinomap im_imap; /* 4096: inode allocation control */ |
142 | struct inode *im_ipimap; /* 4: ptr to inode for imap */ | 142 | struct inode *im_ipimap; /* 4: ptr to inode for imap */ |
143 | struct mutex im_freelock; /* 4: iag free list lock */ | 143 | struct mutex im_freelock; /* 4: iag free list lock */ |
144 | struct mutex im_aglock[MAXAG]; /* 512: per AG locks */ | 144 | struct mutex im_aglock[MAXAG]; /* 512: per AG locks */ |
145 | u32 *im_DBGdimap; | 145 | u32 *im_DBGdimap; |
146 | atomic_t im_numinos; /* num of backed inodes */ | 146 | atomic_t im_numinos; /* num of backed inodes */ |
147 | atomic_t im_numfree; /* num of free backed inodes */ | 147 | atomic_t im_numfree; /* num of free backed inodes */ |
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h index 8f453eff3c83..cb8f30985ad1 100644 --- a/fs/jfs/jfs_incore.h +++ b/fs/jfs/jfs_incore.h | |||
@@ -40,7 +40,7 @@ struct jfs_inode_info { | |||
40 | uint mode2; /* jfs-specific mode */ | 40 | uint mode2; /* jfs-specific mode */ |
41 | uint saved_uid; /* saved for uid mount option */ | 41 | uint saved_uid; /* saved for uid mount option */ |
42 | uint saved_gid; /* saved for gid mount option */ | 42 | uint saved_gid; /* saved for gid mount option */ |
43 | pxd_t ixpxd; /* inode extent descriptor */ | 43 | pxd_t ixpxd; /* inode extent descriptor */ |
44 | dxd_t acl; /* dxd describing acl */ | 44 | dxd_t acl; /* dxd describing acl */ |
45 | dxd_t ea; /* dxd describing ea */ | 45 | dxd_t ea; /* dxd describing ea */ |
46 | time_t otime; /* time created */ | 46 | time_t otime; /* time created */ |
@@ -190,7 +190,7 @@ struct jfs_sb_info { | |||
190 | uint gengen; /* inode generation generator*/ | 190 | uint gengen; /* inode generation generator*/ |
191 | uint inostamp; /* shows inode belongs to fileset*/ | 191 | uint inostamp; /* shows inode belongs to fileset*/ |
192 | 192 | ||
193 | /* Formerly in ipbmap */ | 193 | /* Formerly in ipbmap */ |
194 | struct bmap *bmap; /* incore bmap descriptor */ | 194 | struct bmap *bmap; /* incore bmap descriptor */ |
195 | struct nls_table *nls_tab; /* current codepage */ | 195 | struct nls_table *nls_tab; /* current codepage */ |
196 | struct inode *direct_inode; /* metadata inode */ | 196 | struct inode *direct_inode; /* metadata inode */ |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 44a2f33cb98d..88eae45a4644 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -244,7 +244,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
244 | goto writeRecord; | 244 | goto writeRecord; |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * initialize/update page/transaction recovery lsn | 247 | * initialize/update page/transaction recovery lsn |
248 | */ | 248 | */ |
249 | lsn = log->lsn; | 249 | lsn = log->lsn; |
250 | 250 | ||
@@ -263,7 +263,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
263 | } | 263 | } |
264 | 264 | ||
265 | /* | 265 | /* |
266 | * initialize/update lsn of tblock of the page | 266 | * initialize/update lsn of tblock of the page |
267 | * | 267 | * |
268 | * transaction inherits oldest lsn of pages associated | 268 | * transaction inherits oldest lsn of pages associated |
269 | * with allocation/deallocation of resources (their | 269 | * with allocation/deallocation of resources (their |
@@ -307,7 +307,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
307 | LOGSYNC_UNLOCK(log, flags); | 307 | LOGSYNC_UNLOCK(log, flags); |
308 | 308 | ||
309 | /* | 309 | /* |
310 | * write the log record | 310 | * write the log record |
311 | */ | 311 | */ |
312 | writeRecord: | 312 | writeRecord: |
313 | lsn = lmWriteRecord(log, tblk, lrd, tlck); | 313 | lsn = lmWriteRecord(log, tblk, lrd, tlck); |
@@ -372,7 +372,7 @@ lmWriteRecord(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
372 | goto moveLrd; | 372 | goto moveLrd; |
373 | 373 | ||
374 | /* | 374 | /* |
375 | * move log record data | 375 | * move log record data |
376 | */ | 376 | */ |
377 | /* retrieve source meta-data page to log */ | 377 | /* retrieve source meta-data page to log */ |
378 | if (tlck->flag & tlckPAGELOCK) { | 378 | if (tlck->flag & tlckPAGELOCK) { |
@@ -465,7 +465,7 @@ lmWriteRecord(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
465 | } | 465 | } |
466 | 466 | ||
467 | /* | 467 | /* |
468 | * move log record descriptor | 468 | * move log record descriptor |
469 | */ | 469 | */ |
470 | moveLrd: | 470 | moveLrd: |
471 | lrd->length = cpu_to_le16(len); | 471 | lrd->length = cpu_to_le16(len); |
@@ -574,7 +574,7 @@ static int lmNextPage(struct jfs_log * log) | |||
574 | LOGGC_LOCK(log); | 574 | LOGGC_LOCK(log); |
575 | 575 | ||
576 | /* | 576 | /* |
577 | * write or queue the full page at the tail of write queue | 577 | * write or queue the full page at the tail of write queue |
578 | */ | 578 | */ |
579 | /* get the tail tblk on commit queue */ | 579 | /* get the tail tblk on commit queue */ |
580 | if (list_empty(&log->cqueue)) | 580 | if (list_empty(&log->cqueue)) |
@@ -625,7 +625,7 @@ static int lmNextPage(struct jfs_log * log) | |||
625 | LOGGC_UNLOCK(log); | 625 | LOGGC_UNLOCK(log); |
626 | 626 | ||
627 | /* | 627 | /* |
628 | * allocate/initialize next page | 628 | * allocate/initialize next page |
629 | */ | 629 | */ |
630 | /* if log wraps, the first data page of log is 2 | 630 | /* if log wraps, the first data page of log is 2 |
631 | * (0 never used, 1 is superblock). | 631 | * (0 never used, 1 is superblock). |
@@ -953,7 +953,7 @@ static int lmLogSync(struct jfs_log * log, int hard_sync) | |||
953 | } | 953 | } |
954 | 954 | ||
955 | /* | 955 | /* |
956 | * forward syncpt | 956 | * forward syncpt |
957 | */ | 957 | */ |
958 | /* if last sync is same as last syncpt, | 958 | /* if last sync is same as last syncpt, |
959 | * invoke sync point forward processing to update sync. | 959 | * invoke sync point forward processing to update sync. |
@@ -989,7 +989,7 @@ static int lmLogSync(struct jfs_log * log, int hard_sync) | |||
989 | lsn = log->lsn; | 989 | lsn = log->lsn; |
990 | 990 | ||
991 | /* | 991 | /* |
992 | * setup next syncpt trigger (SWAG) | 992 | * setup next syncpt trigger (SWAG) |
993 | */ | 993 | */ |
994 | logsize = log->logsize; | 994 | logsize = log->logsize; |
995 | 995 | ||
@@ -1000,11 +1000,11 @@ static int lmLogSync(struct jfs_log * log, int hard_sync) | |||
1000 | if (more < 2 * LOGPSIZE) { | 1000 | if (more < 2 * LOGPSIZE) { |
1001 | jfs_warn("\n ... Log Wrap ... Log Wrap ... Log Wrap ...\n"); | 1001 | jfs_warn("\n ... Log Wrap ... Log Wrap ... Log Wrap ...\n"); |
1002 | /* | 1002 | /* |
1003 | * log wrapping | 1003 | * log wrapping |
1004 | * | 1004 | * |
1005 | * option 1 - panic ? No.! | 1005 | * option 1 - panic ? No.! |
1006 | * option 2 - shutdown file systems | 1006 | * option 2 - shutdown file systems |
1007 | * associated with log ? | 1007 | * associated with log ? |
1008 | * option 3 - extend log ? | 1008 | * option 3 - extend log ? |
1009 | */ | 1009 | */ |
1010 | /* | 1010 | /* |
@@ -1062,7 +1062,7 @@ void jfs_syncpt(struct jfs_log *log, int hard_sync) | |||
1062 | /* | 1062 | /* |
1063 | * NAME: lmLogOpen() | 1063 | * NAME: lmLogOpen() |
1064 | * | 1064 | * |
1065 | * FUNCTION: open the log on first open; | 1065 | * FUNCTION: open the log on first open; |
1066 | * insert filesystem in the active list of the log. | 1066 | * insert filesystem in the active list of the log. |
1067 | * | 1067 | * |
1068 | * PARAMETER: ipmnt - file system mount inode | 1068 | * PARAMETER: ipmnt - file system mount inode |
@@ -1113,7 +1113,7 @@ int lmLogOpen(struct super_block *sb) | |||
1113 | init_waitqueue_head(&log->syncwait); | 1113 | init_waitqueue_head(&log->syncwait); |
1114 | 1114 | ||
1115 | /* | 1115 | /* |
1116 | * external log as separate logical volume | 1116 | * external log as separate logical volume |
1117 | * | 1117 | * |
1118 | * file systems to log may have n-to-1 relationship; | 1118 | * file systems to log may have n-to-1 relationship; |
1119 | */ | 1119 | */ |
@@ -1155,7 +1155,7 @@ journal_found: | |||
1155 | return 0; | 1155 | return 0; |
1156 | 1156 | ||
1157 | /* | 1157 | /* |
1158 | * unwind on error | 1158 | * unwind on error |
1159 | */ | 1159 | */ |
1160 | shutdown: /* unwind lbmLogInit() */ | 1160 | shutdown: /* unwind lbmLogInit() */ |
1161 | list_del(&log->journal_list); | 1161 | list_del(&log->journal_list); |
@@ -1427,7 +1427,7 @@ int lmLogInit(struct jfs_log * log) | |||
1427 | return 0; | 1427 | return 0; |
1428 | 1428 | ||
1429 | /* | 1429 | /* |
1430 | * unwind on error | 1430 | * unwind on error |
1431 | */ | 1431 | */ |
1432 | errout30: /* release log page */ | 1432 | errout30: /* release log page */ |
1433 | log->wqueue = NULL; | 1433 | log->wqueue = NULL; |
@@ -1480,7 +1480,7 @@ int lmLogClose(struct super_block *sb) | |||
1480 | 1480 | ||
1481 | if (test_bit(log_INLINELOG, &log->flag)) { | 1481 | if (test_bit(log_INLINELOG, &log->flag)) { |
1482 | /* | 1482 | /* |
1483 | * in-line log in host file system | 1483 | * in-line log in host file system |
1484 | */ | 1484 | */ |
1485 | rc = lmLogShutdown(log); | 1485 | rc = lmLogShutdown(log); |
1486 | kfree(log); | 1486 | kfree(log); |
@@ -1504,7 +1504,7 @@ int lmLogClose(struct super_block *sb) | |||
1504 | goto out; | 1504 | goto out; |
1505 | 1505 | ||
1506 | /* | 1506 | /* |
1507 | * external log as separate logical volume | 1507 | * external log as separate logical volume |
1508 | */ | 1508 | */ |
1509 | list_del(&log->journal_list); | 1509 | list_del(&log->journal_list); |
1510 | bdev = log->bdev; | 1510 | bdev = log->bdev; |
@@ -1723,7 +1723,7 @@ int lmLogShutdown(struct jfs_log * log) | |||
1723 | * | 1723 | * |
1724 | * PARAMETE: log - pointer to logs inode. | 1724 | * PARAMETE: log - pointer to logs inode. |
1725 | * fsdev - kdev_t of filesystem. | 1725 | * fsdev - kdev_t of filesystem. |
1726 | * serial - pointer to returned log serial number | 1726 | * serial - pointer to returned log serial number |
1727 | * activate - insert/remove device from active list. | 1727 | * activate - insert/remove device from active list. |
1728 | * | 1728 | * |
1729 | * RETURN: 0 - success | 1729 | * RETURN: 0 - success |
@@ -1963,7 +1963,7 @@ static void lbmfree(struct lbuf * bp) | |||
1963 | * FUNCTION: add a log buffer to the log redrive list | 1963 | * FUNCTION: add a log buffer to the log redrive list |
1964 | * | 1964 | * |
1965 | * PARAMETER: | 1965 | * PARAMETER: |
1966 | * bp - log buffer | 1966 | * bp - log buffer |
1967 | * | 1967 | * |
1968 | * NOTES: | 1968 | * NOTES: |
1969 | * Takes log_redrive_lock. | 1969 | * Takes log_redrive_lock. |
@@ -2054,7 +2054,7 @@ static void lbmWrite(struct jfs_log * log, struct lbuf * bp, int flag, | |||
2054 | bp->l_flag = flag; | 2054 | bp->l_flag = flag; |
2055 | 2055 | ||
2056 | /* | 2056 | /* |
2057 | * insert bp at tail of write queue associated with log | 2057 | * insert bp at tail of write queue associated with log |
2058 | * | 2058 | * |
2059 | * (request is either for bp already/currently at head of queue | 2059 | * (request is either for bp already/currently at head of queue |
2060 | * or new bp to be inserted at tail) | 2060 | * or new bp to be inserted at tail) |
@@ -2117,7 +2117,7 @@ static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag) | |||
2117 | log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); | 2117 | log->base + (bp->l_pn << (L2LOGPSIZE - log->l2bsize)); |
2118 | 2118 | ||
2119 | /* | 2119 | /* |
2120 | * initiate pageout of the page | 2120 | * initiate pageout of the page |
2121 | */ | 2121 | */ |
2122 | lbmStartIO(bp); | 2122 | lbmStartIO(bp); |
2123 | } | 2123 | } |
@@ -2128,7 +2128,7 @@ static void lbmDirectWrite(struct jfs_log * log, struct lbuf * bp, int flag) | |||
2128 | * | 2128 | * |
2129 | * FUNCTION: Interface to DD strategy routine | 2129 | * FUNCTION: Interface to DD strategy routine |
2130 | * | 2130 | * |
2131 | * RETURN: none | 2131 | * RETURN: none |
2132 | * | 2132 | * |
2133 | * serialization: LCACHE_LOCK() is NOT held during log i/o; | 2133 | * serialization: LCACHE_LOCK() is NOT held during log i/o; |
2134 | */ | 2134 | */ |
@@ -2222,7 +2222,7 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
2222 | bio_put(bio); | 2222 | bio_put(bio); |
2223 | 2223 | ||
2224 | /* | 2224 | /* |
2225 | * pagein completion | 2225 | * pagein completion |
2226 | */ | 2226 | */ |
2227 | if (bp->l_flag & lbmREAD) { | 2227 | if (bp->l_flag & lbmREAD) { |
2228 | bp->l_flag &= ~lbmREAD; | 2228 | bp->l_flag &= ~lbmREAD; |
@@ -2236,7 +2236,7 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | /* | 2238 | /* |
2239 | * pageout completion | 2239 | * pageout completion |
2240 | * | 2240 | * |
2241 | * the bp at the head of write queue has completed pageout. | 2241 | * the bp at the head of write queue has completed pageout. |
2242 | * | 2242 | * |
@@ -2302,7 +2302,7 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | /* | 2304 | /* |
2305 | * synchronous pageout: | 2305 | * synchronous pageout: |
2306 | * | 2306 | * |
2307 | * buffer has not necessarily been removed from write queue | 2307 | * buffer has not necessarily been removed from write queue |
2308 | * (e.g., synchronous write of partial-page with COMMIT): | 2308 | * (e.g., synchronous write of partial-page with COMMIT): |
@@ -2316,7 +2316,7 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | /* | 2318 | /* |
2319 | * Group Commit pageout: | 2319 | * Group Commit pageout: |
2320 | */ | 2320 | */ |
2321 | else if (bp->l_flag & lbmGC) { | 2321 | else if (bp->l_flag & lbmGC) { |
2322 | LCACHE_UNLOCK(flags); | 2322 | LCACHE_UNLOCK(flags); |
@@ -2324,7 +2324,7 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
2324 | } | 2324 | } |
2325 | 2325 | ||
2326 | /* | 2326 | /* |
2327 | * asynchronous pageout: | 2327 | * asynchronous pageout: |
2328 | * | 2328 | * |
2329 | * buffer must have been removed from write queue: | 2329 | * buffer must have been removed from write queue: |
2330 | * insert buffer at head of freelist where it can be recycled | 2330 | * insert buffer at head of freelist where it can be recycled |
@@ -2375,7 +2375,7 @@ int jfsIOWait(void *arg) | |||
2375 | * FUNCTION: format file system log | 2375 | * FUNCTION: format file system log |
2376 | * | 2376 | * |
2377 | * PARAMETERS: | 2377 | * PARAMETERS: |
2378 | * log - volume log | 2378 | * log - volume log |
2379 | * logAddress - start address of log space in FS block | 2379 | * logAddress - start address of log space in FS block |
2380 | * logSize - length of log space in FS block; | 2380 | * logSize - length of log space in FS block; |
2381 | * | 2381 | * |
@@ -2407,16 +2407,16 @@ int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize) | |||
2407 | npages = logSize >> sbi->l2nbperpage; | 2407 | npages = logSize >> sbi->l2nbperpage; |
2408 | 2408 | ||
2409 | /* | 2409 | /* |
2410 | * log space: | 2410 | * log space: |
2411 | * | 2411 | * |
2412 | * page 0 - reserved; | 2412 | * page 0 - reserved; |
2413 | * page 1 - log superblock; | 2413 | * page 1 - log superblock; |
2414 | * page 2 - log data page: A SYNC log record is written | 2414 | * page 2 - log data page: A SYNC log record is written |
2415 | * into this page at logform time; | 2415 | * into this page at logform time; |
2416 | * pages 3-N - log data page: set to empty log data pages; | 2416 | * pages 3-N - log data page: set to empty log data pages; |
2417 | */ | 2417 | */ |
2418 | /* | 2418 | /* |
2419 | * init log superblock: log page 1 | 2419 | * init log superblock: log page 1 |
2420 | */ | 2420 | */ |
2421 | logsuper = (struct logsuper *) bp->l_ldata; | 2421 | logsuper = (struct logsuper *) bp->l_ldata; |
2422 | 2422 | ||
@@ -2436,7 +2436,7 @@ int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize) | |||
2436 | goto exit; | 2436 | goto exit; |
2437 | 2437 | ||
2438 | /* | 2438 | /* |
2439 | * init pages 2 to npages-1 as log data pages: | 2439 | * init pages 2 to npages-1 as log data pages: |
2440 | * | 2440 | * |
2441 | * log page sequence number (lpsn) initialization: | 2441 | * log page sequence number (lpsn) initialization: |
2442 | * | 2442 | * |
@@ -2479,7 +2479,7 @@ int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize) | |||
2479 | goto exit; | 2479 | goto exit; |
2480 | 2480 | ||
2481 | /* | 2481 | /* |
2482 | * initialize succeeding log pages: lpsn = 0, 1, ..., (N-2) | 2482 | * initialize succeeding log pages: lpsn = 0, 1, ..., (N-2) |
2483 | */ | 2483 | */ |
2484 | for (lspn = 0; lspn < npages - 3; lspn++) { | 2484 | for (lspn = 0; lspn < npages - 3; lspn++) { |
2485 | lp->h.page = lp->t.page = cpu_to_le32(lspn); | 2485 | lp->h.page = lp->t.page = cpu_to_le32(lspn); |
@@ -2495,7 +2495,7 @@ int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize) | |||
2495 | rc = 0; | 2495 | rc = 0; |
2496 | exit: | 2496 | exit: |
2497 | /* | 2497 | /* |
2498 | * finalize log | 2498 | * finalize log |
2499 | */ | 2499 | */ |
2500 | /* release the buffer */ | 2500 | /* release the buffer */ |
2501 | lbmFree(bp); | 2501 | lbmFree(bp); |
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index a53fb17ea219..1f85ef0ec045 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h | |||
@@ -144,7 +144,7 @@ struct logpage { | |||
144 | * | 144 | * |
145 | * (this comment should be rewritten !) | 145 | * (this comment should be rewritten !) |
146 | * jfs uses only "after" log records (only a single writer is allowed | 146 | * jfs uses only "after" log records (only a single writer is allowed |
147 | * in a page, pages are written to temporary paging space if | 147 | * in a page, pages are written to temporary paging space if |
148 | * if they must be written to disk before commit, and i/o is | 148 | * if they must be written to disk before commit, and i/o is |
149 | * scheduled for modified pages to their home location after | 149 | * scheduled for modified pages to their home location after |
150 | * the log records containing the after values and the commit | 150 | * the log records containing the after values and the commit |
@@ -153,7 +153,7 @@ struct logpage { | |||
153 | * | 153 | * |
154 | * a log record consists of a data area of variable length followed by | 154 | * a log record consists of a data area of variable length followed by |
155 | * a descriptor of fixed size LOGRDSIZE bytes. | 155 | * a descriptor of fixed size LOGRDSIZE bytes. |
156 | * the data area is rounded up to an integral number of 4-bytes and | 156 | * the data area is rounded up to an integral number of 4-bytes and |
157 | * must be no longer than LOGPSIZE. | 157 | * must be no longer than LOGPSIZE. |
158 | * the descriptor is of size of multiple of 4-bytes and aligned on a | 158 | * the descriptor is of size of multiple of 4-bytes and aligned on a |
159 | * 4-byte boundary. | 159 | * 4-byte boundary. |
@@ -215,13 +215,13 @@ struct lrd { | |||
215 | union { | 215 | union { |
216 | 216 | ||
217 | /* | 217 | /* |
218 | * COMMIT: commit | 218 | * COMMIT: commit |
219 | * | 219 | * |
220 | * transaction commit: no type-dependent information; | 220 | * transaction commit: no type-dependent information; |
221 | */ | 221 | */ |
222 | 222 | ||
223 | /* | 223 | /* |
224 | * REDOPAGE: after-image | 224 | * REDOPAGE: after-image |
225 | * | 225 | * |
226 | * apply after-image; | 226 | * apply after-image; |
227 | * | 227 | * |
@@ -236,7 +236,7 @@ struct lrd { | |||
236 | } redopage; /* (20) */ | 236 | } redopage; /* (20) */ |
237 | 237 | ||
238 | /* | 238 | /* |
239 | * NOREDOPAGE: the page is freed | 239 | * NOREDOPAGE: the page is freed |
240 | * | 240 | * |
241 | * do not apply after-image records which precede this record | 241 | * do not apply after-image records which precede this record |
242 | * in the log with the same page block number to this page. | 242 | * in the log with the same page block number to this page. |
@@ -252,7 +252,7 @@ struct lrd { | |||
252 | } noredopage; /* (20) */ | 252 | } noredopage; /* (20) */ |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * UPDATEMAP: update block allocation map | 255 | * UPDATEMAP: update block allocation map |
256 | * | 256 | * |
257 | * either in-line PXD, | 257 | * either in-line PXD, |
258 | * or out-of-line XADLIST; | 258 | * or out-of-line XADLIST; |
@@ -268,7 +268,7 @@ struct lrd { | |||
268 | } updatemap; /* (20) */ | 268 | } updatemap; /* (20) */ |
269 | 269 | ||
270 | /* | 270 | /* |
271 | * NOREDOINOEXT: the inode extent is freed | 271 | * NOREDOINOEXT: the inode extent is freed |
272 | * | 272 | * |
273 | * do not apply after-image records which precede this | 273 | * do not apply after-image records which precede this |
274 | * record in the log with the any of the 4 page block | 274 | * record in the log with the any of the 4 page block |
@@ -286,7 +286,7 @@ struct lrd { | |||
286 | } noredoinoext; /* (20) */ | 286 | } noredoinoext; /* (20) */ |
287 | 287 | ||
288 | /* | 288 | /* |
289 | * SYNCPT: log sync point | 289 | * SYNCPT: log sync point |
290 | * | 290 | * |
291 | * replay log upto syncpt address specified; | 291 | * replay log upto syncpt address specified; |
292 | */ | 292 | */ |
@@ -295,13 +295,13 @@ struct lrd { | |||
295 | } syncpt; | 295 | } syncpt; |
296 | 296 | ||
297 | /* | 297 | /* |
298 | * MOUNT: file system mount | 298 | * MOUNT: file system mount |
299 | * | 299 | * |
300 | * file system mount: no type-dependent information; | 300 | * file system mount: no type-dependent information; |
301 | */ | 301 | */ |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * ? FREEXTENT: free specified extent(s) | 304 | * ? FREEXTENT: free specified extent(s) |
305 | * | 305 | * |
306 | * free specified extent(s) from block allocation map | 306 | * free specified extent(s) from block allocation map |
307 | * N.B.: nextents should be length of data/sizeof(xad_t) | 307 | * N.B.: nextents should be length of data/sizeof(xad_t) |
@@ -314,7 +314,7 @@ struct lrd { | |||
314 | } freextent; | 314 | } freextent; |
315 | 315 | ||
316 | /* | 316 | /* |
317 | * ? NOREDOFILE: this file is freed | 317 | * ? NOREDOFILE: this file is freed |
318 | * | 318 | * |
319 | * do not apply records which precede this record in the log | 319 | * do not apply records which precede this record in the log |
320 | * with the same inode number. | 320 | * with the same inode number. |
@@ -330,7 +330,7 @@ struct lrd { | |||
330 | } noredofile; | 330 | } noredofile; |
331 | 331 | ||
332 | /* | 332 | /* |
333 | * ? NEWPAGE: | 333 | * ? NEWPAGE: |
334 | * | 334 | * |
335 | * metadata type dependent | 335 | * metadata type dependent |
336 | */ | 336 | */ |
@@ -342,7 +342,7 @@ struct lrd { | |||
342 | } newpage; | 342 | } newpage; |
343 | 343 | ||
344 | /* | 344 | /* |
345 | * ? DUMMY: filler | 345 | * ? DUMMY: filler |
346 | * | 346 | * |
347 | * no type-dependent information | 347 | * no type-dependent information |
348 | */ | 348 | */ |
diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index 4dd479834897..644429acb8c0 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c | |||
@@ -80,7 +80,7 @@ static int logMOUNT(struct super_block *sb); | |||
80 | */ | 80 | */ |
81 | int jfs_mount(struct super_block *sb) | 81 | int jfs_mount(struct super_block *sb) |
82 | { | 82 | { |
83 | int rc = 0; /* Return code */ | 83 | int rc = 0; /* Return code */ |
84 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 84 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
85 | struct inode *ipaimap = NULL; | 85 | struct inode *ipaimap = NULL; |
86 | struct inode *ipaimap2 = NULL; | 86 | struct inode *ipaimap2 = NULL; |
@@ -169,7 +169,7 @@ int jfs_mount(struct super_block *sb) | |||
169 | sbi->ipaimap2 = NULL; | 169 | sbi->ipaimap2 = NULL; |
170 | 170 | ||
171 | /* | 171 | /* |
172 | * mount (the only/single) fileset | 172 | * mount (the only/single) fileset |
173 | */ | 173 | */ |
174 | /* | 174 | /* |
175 | * open fileset inode allocation map (aka fileset inode) | 175 | * open fileset inode allocation map (aka fileset inode) |
@@ -195,7 +195,7 @@ int jfs_mount(struct super_block *sb) | |||
195 | goto out; | 195 | goto out; |
196 | 196 | ||
197 | /* | 197 | /* |
198 | * unwind on error | 198 | * unwind on error |
199 | */ | 199 | */ |
200 | errout41: /* close fileset inode allocation map inode */ | 200 | errout41: /* close fileset inode allocation map inode */ |
201 | diFreeSpecial(ipimap); | 201 | diFreeSpecial(ipimap); |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 25430d0b0d59..f2dc4b986392 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * jfs_txnmgr.c: transaction manager | 21 | * jfs_txnmgr.c: transaction manager |
22 | * | 22 | * |
23 | * notes: | 23 | * notes: |
24 | * transaction starts with txBegin() and ends with txCommit() | 24 | * transaction starts with txBegin() and ends with txCommit() |
@@ -60,7 +60,7 @@ | |||
60 | #include "jfs_debug.h" | 60 | #include "jfs_debug.h" |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * transaction management structures | 63 | * transaction management structures |
64 | */ | 64 | */ |
65 | static struct { | 65 | static struct { |
66 | int freetid; /* index of a free tid structure */ | 66 | int freetid; /* index of a free tid structure */ |
@@ -103,19 +103,19 @@ module_param(nTxLock, int, 0); | |||
103 | MODULE_PARM_DESC(nTxLock, | 103 | MODULE_PARM_DESC(nTxLock, |
104 | "Number of transaction locks (max:65536)"); | 104 | "Number of transaction locks (max:65536)"); |
105 | 105 | ||
106 | struct tblock *TxBlock; /* transaction block table */ | 106 | struct tblock *TxBlock; /* transaction block table */ |
107 | static int TxLockLWM; /* Low water mark for number of txLocks used */ | 107 | static int TxLockLWM; /* Low water mark for number of txLocks used */ |
108 | static int TxLockHWM; /* High water mark for number of txLocks used */ | 108 | static int TxLockHWM; /* High water mark for number of txLocks used */ |
109 | static int TxLockVHWM; /* Very High water mark */ | 109 | static int TxLockVHWM; /* Very High water mark */ |
110 | struct tlock *TxLock; /* transaction lock table */ | 110 | struct tlock *TxLock; /* transaction lock table */ |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * transaction management lock | 113 | * transaction management lock |
114 | */ | 114 | */ |
115 | static DEFINE_SPINLOCK(jfsTxnLock); | 115 | static DEFINE_SPINLOCK(jfsTxnLock); |
116 | 116 | ||
117 | #define TXN_LOCK() spin_lock(&jfsTxnLock) | 117 | #define TXN_LOCK() spin_lock(&jfsTxnLock) |
118 | #define TXN_UNLOCK() spin_unlock(&jfsTxnLock) | 118 | #define TXN_UNLOCK() spin_unlock(&jfsTxnLock) |
119 | 119 | ||
120 | #define LAZY_LOCK_INIT() spin_lock_init(&TxAnchor.LazyLock); | 120 | #define LAZY_LOCK_INIT() spin_lock_init(&TxAnchor.LazyLock); |
121 | #define LAZY_LOCK(flags) spin_lock_irqsave(&TxAnchor.LazyLock, flags) | 121 | #define LAZY_LOCK(flags) spin_lock_irqsave(&TxAnchor.LazyLock, flags) |
@@ -148,7 +148,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event) | |||
148 | #define TXN_WAKEUP(event) wake_up_all(event) | 148 | #define TXN_WAKEUP(event) wake_up_all(event) |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * statistics | 151 | * statistics |
152 | */ | 152 | */ |
153 | static struct { | 153 | static struct { |
154 | tid_t maxtid; /* 4: biggest tid ever used */ | 154 | tid_t maxtid; /* 4: biggest tid ever used */ |
@@ -181,8 +181,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
181 | static void LogSyncRelease(struct metapage * mp); | 181 | static void LogSyncRelease(struct metapage * mp); |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * transaction block/lock management | 184 | * transaction block/lock management |
185 | * --------------------------------- | 185 | * --------------------------------- |
186 | */ | 186 | */ |
187 | 187 | ||
188 | /* | 188 | /* |
@@ -227,9 +227,9 @@ static void txLockFree(lid_t lid) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | /* | 229 | /* |
230 | * NAME: txInit() | 230 | * NAME: txInit() |
231 | * | 231 | * |
232 | * FUNCTION: initialize transaction management structures | 232 | * FUNCTION: initialize transaction management structures |
233 | * | 233 | * |
234 | * RETURN: | 234 | * RETURN: |
235 | * | 235 | * |
@@ -333,9 +333,9 @@ int txInit(void) | |||
333 | } | 333 | } |
334 | 334 | ||
335 | /* | 335 | /* |
336 | * NAME: txExit() | 336 | * NAME: txExit() |
337 | * | 337 | * |
338 | * FUNCTION: clean up when module is unloaded | 338 | * FUNCTION: clean up when module is unloaded |
339 | */ | 339 | */ |
340 | void txExit(void) | 340 | void txExit(void) |
341 | { | 341 | { |
@@ -346,12 +346,12 @@ void txExit(void) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /* | 348 | /* |
349 | * NAME: txBegin() | 349 | * NAME: txBegin() |
350 | * | 350 | * |
351 | * FUNCTION: start a transaction. | 351 | * FUNCTION: start a transaction. |
352 | * | 352 | * |
353 | * PARAMETER: sb - superblock | 353 | * PARAMETER: sb - superblock |
354 | * flag - force for nested tx; | 354 | * flag - force for nested tx; |
355 | * | 355 | * |
356 | * RETURN: tid - transaction id | 356 | * RETURN: tid - transaction id |
357 | * | 357 | * |
@@ -447,13 +447,13 @@ tid_t txBegin(struct super_block *sb, int flag) | |||
447 | } | 447 | } |
448 | 448 | ||
449 | /* | 449 | /* |
450 | * NAME: txBeginAnon() | 450 | * NAME: txBeginAnon() |
451 | * | 451 | * |
452 | * FUNCTION: start an anonymous transaction. | 452 | * FUNCTION: start an anonymous transaction. |
453 | * Blocks if logsync or available tlocks are low to prevent | 453 | * Blocks if logsync or available tlocks are low to prevent |
454 | * anonymous tlocks from depleting supply. | 454 | * anonymous tlocks from depleting supply. |
455 | * | 455 | * |
456 | * PARAMETER: sb - superblock | 456 | * PARAMETER: sb - superblock |
457 | * | 457 | * |
458 | * RETURN: none | 458 | * RETURN: none |
459 | */ | 459 | */ |
@@ -489,11 +489,11 @@ void txBeginAnon(struct super_block *sb) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | /* | 491 | /* |
492 | * txEnd() | 492 | * txEnd() |
493 | * | 493 | * |
494 | * function: free specified transaction block. | 494 | * function: free specified transaction block. |
495 | * | 495 | * |
496 | * logsync barrier processing: | 496 | * logsync barrier processing: |
497 | * | 497 | * |
498 | * serialization: | 498 | * serialization: |
499 | */ | 499 | */ |
@@ -577,13 +577,13 @@ wakeup: | |||
577 | } | 577 | } |
578 | 578 | ||
579 | /* | 579 | /* |
580 | * txLock() | 580 | * txLock() |
581 | * | 581 | * |
582 | * function: acquire a transaction lock on the specified <mp> | 582 | * function: acquire a transaction lock on the specified <mp> |
583 | * | 583 | * |
584 | * parameter: | 584 | * parameter: |
585 | * | 585 | * |
586 | * return: transaction lock id | 586 | * return: transaction lock id |
587 | * | 587 | * |
588 | * serialization: | 588 | * serialization: |
589 | */ | 589 | */ |
@@ -857,17 +857,17 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, | |||
857 | } | 857 | } |
858 | 858 | ||
859 | /* | 859 | /* |
860 | * NAME: txRelease() | 860 | * NAME: txRelease() |
861 | * | 861 | * |
862 | * FUNCTION: Release buffers associated with transaction locks, but don't | 862 | * FUNCTION: Release buffers associated with transaction locks, but don't |
863 | * mark homeok yet. The allows other transactions to modify | 863 | * mark homeok yet. The allows other transactions to modify |
864 | * buffers, but won't let them go to disk until commit record | 864 | * buffers, but won't let them go to disk until commit record |
865 | * actually gets written. | 865 | * actually gets written. |
866 | * | 866 | * |
867 | * PARAMETER: | 867 | * PARAMETER: |
868 | * tblk - | 868 | * tblk - |
869 | * | 869 | * |
870 | * RETURN: Errors from subroutines. | 870 | * RETURN: Errors from subroutines. |
871 | */ | 871 | */ |
872 | static void txRelease(struct tblock * tblk) | 872 | static void txRelease(struct tblock * tblk) |
873 | { | 873 | { |
@@ -896,10 +896,10 @@ static void txRelease(struct tblock * tblk) | |||
896 | } | 896 | } |
897 | 897 | ||
898 | /* | 898 | /* |
899 | * NAME: txUnlock() | 899 | * NAME: txUnlock() |
900 | * | 900 | * |
901 | * FUNCTION: Initiates pageout of pages modified by tid in journalled | 901 | * FUNCTION: Initiates pageout of pages modified by tid in journalled |
902 | * objects and frees their lockwords. | 902 | * objects and frees their lockwords. |
903 | */ | 903 | */ |
904 | static void txUnlock(struct tblock * tblk) | 904 | static void txUnlock(struct tblock * tblk) |
905 | { | 905 | { |
@@ -983,10 +983,10 @@ static void txUnlock(struct tblock * tblk) | |||
983 | } | 983 | } |
984 | 984 | ||
985 | /* | 985 | /* |
986 | * txMaplock() | 986 | * txMaplock() |
987 | * | 987 | * |
988 | * function: allocate a transaction lock for freed page/entry; | 988 | * function: allocate a transaction lock for freed page/entry; |
989 | * for freed page, maplock is used as xtlock/dtlock type; | 989 | * for freed page, maplock is used as xtlock/dtlock type; |
990 | */ | 990 | */ |
991 | struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) | 991 | struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) |
992 | { | 992 | { |
@@ -1057,7 +1057,7 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) | |||
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | /* | 1059 | /* |
1060 | * txLinelock() | 1060 | * txLinelock() |
1061 | * | 1061 | * |
1062 | * function: allocate a transaction lock for log vector list | 1062 | * function: allocate a transaction lock for log vector list |
1063 | */ | 1063 | */ |
@@ -1092,39 +1092,39 @@ struct linelock *txLinelock(struct linelock * tlock) | |||
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | /* | 1094 | /* |
1095 | * transaction commit management | 1095 | * transaction commit management |
1096 | * ----------------------------- | 1096 | * ----------------------------- |
1097 | */ | 1097 | */ |
1098 | 1098 | ||
1099 | /* | 1099 | /* |
1100 | * NAME: txCommit() | 1100 | * NAME: txCommit() |
1101 | * | 1101 | * |
1102 | * FUNCTION: commit the changes to the objects specified in | 1102 | * FUNCTION: commit the changes to the objects specified in |
1103 | * clist. For journalled segments only the | 1103 | * clist. For journalled segments only the |
1104 | * changes of the caller are committed, ie by tid. | 1104 | * changes of the caller are committed, ie by tid. |
1105 | * for non-journalled segments the data are flushed to | 1105 | * for non-journalled segments the data are flushed to |
1106 | * disk and then the change to the disk inode and indirect | 1106 | * disk and then the change to the disk inode and indirect |
1107 | * blocks committed (so blocks newly allocated to the | 1107 | * blocks committed (so blocks newly allocated to the |
1108 | * segment will be made a part of the segment atomically). | 1108 | * segment will be made a part of the segment atomically). |
1109 | * | 1109 | * |
1110 | * all of the segments specified in clist must be in | 1110 | * all of the segments specified in clist must be in |
1111 | * one file system. no more than 6 segments are needed | 1111 | * one file system. no more than 6 segments are needed |
1112 | * to handle all unix svcs. | 1112 | * to handle all unix svcs. |
1113 | * | 1113 | * |
1114 | * if the i_nlink field (i.e. disk inode link count) | 1114 | * if the i_nlink field (i.e. disk inode link count) |
1115 | * is zero, and the type of inode is a regular file or | 1115 | * is zero, and the type of inode is a regular file or |
1116 | * directory, or symbolic link , the inode is truncated | 1116 | * directory, or symbolic link , the inode is truncated |
1117 | * to zero length. the truncation is committed but the | 1117 | * to zero length. the truncation is committed but the |
1118 | * VM resources are unaffected until it is closed (see | 1118 | * VM resources are unaffected until it is closed (see |
1119 | * iput and iclose). | 1119 | * iput and iclose). |
1120 | * | 1120 | * |
1121 | * PARAMETER: | 1121 | * PARAMETER: |
1122 | * | 1122 | * |
1123 | * RETURN: | 1123 | * RETURN: |
1124 | * | 1124 | * |
1125 | * serialization: | 1125 | * serialization: |
1126 | * on entry the inode lock on each segment is assumed | 1126 | * on entry the inode lock on each segment is assumed |
1127 | * to be held. | 1127 | * to be held. |
1128 | * | 1128 | * |
1129 | * i/o error: | 1129 | * i/o error: |
1130 | */ | 1130 | */ |
@@ -1175,7 +1175,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1175 | if ((flag & (COMMIT_FORCE | COMMIT_SYNC)) == 0) | 1175 | if ((flag & (COMMIT_FORCE | COMMIT_SYNC)) == 0) |
1176 | tblk->xflag |= COMMIT_LAZY; | 1176 | tblk->xflag |= COMMIT_LAZY; |
1177 | /* | 1177 | /* |
1178 | * prepare non-journaled objects for commit | 1178 | * prepare non-journaled objects for commit |
1179 | * | 1179 | * |
1180 | * flush data pages of non-journaled file | 1180 | * flush data pages of non-journaled file |
1181 | * to prevent the file getting non-initialized disk blocks | 1181 | * to prevent the file getting non-initialized disk blocks |
@@ -1186,7 +1186,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1186 | cd.nip = nip; | 1186 | cd.nip = nip; |
1187 | 1187 | ||
1188 | /* | 1188 | /* |
1189 | * acquire transaction lock on (on-disk) inodes | 1189 | * acquire transaction lock on (on-disk) inodes |
1190 | * | 1190 | * |
1191 | * update on-disk inode from in-memory inode | 1191 | * update on-disk inode from in-memory inode |
1192 | * acquiring transaction locks for AFTER records | 1192 | * acquiring transaction locks for AFTER records |
@@ -1262,7 +1262,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | /* | 1264 | /* |
1265 | * write log records from transaction locks | 1265 | * write log records from transaction locks |
1266 | * | 1266 | * |
1267 | * txUpdateMap() resets XAD_NEW in XAD. | 1267 | * txUpdateMap() resets XAD_NEW in XAD. |
1268 | */ | 1268 | */ |
@@ -1294,7 +1294,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1294 | !test_cflag(COMMIT_Nolink, tblk->u.ip))); | 1294 | !test_cflag(COMMIT_Nolink, tblk->u.ip))); |
1295 | 1295 | ||
1296 | /* | 1296 | /* |
1297 | * write COMMIT log record | 1297 | * write COMMIT log record |
1298 | */ | 1298 | */ |
1299 | lrd->type = cpu_to_le16(LOG_COMMIT); | 1299 | lrd->type = cpu_to_le16(LOG_COMMIT); |
1300 | lrd->length = 0; | 1300 | lrd->length = 0; |
@@ -1303,7 +1303,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1303 | lmGroupCommit(log, tblk); | 1303 | lmGroupCommit(log, tblk); |
1304 | 1304 | ||
1305 | /* | 1305 | /* |
1306 | * - transaction is now committed - | 1306 | * - transaction is now committed - |
1307 | */ | 1307 | */ |
1308 | 1308 | ||
1309 | /* | 1309 | /* |
@@ -1314,11 +1314,11 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1314 | txForce(tblk); | 1314 | txForce(tblk); |
1315 | 1315 | ||
1316 | /* | 1316 | /* |
1317 | * update allocation map. | 1317 | * update allocation map. |
1318 | * | 1318 | * |
1319 | * update inode allocation map and inode: | 1319 | * update inode allocation map and inode: |
1320 | * free pager lock on memory object of inode if any. | 1320 | * free pager lock on memory object of inode if any. |
1321 | * update block allocation map. | 1321 | * update block allocation map. |
1322 | * | 1322 | * |
1323 | * txUpdateMap() resets XAD_NEW in XAD. | 1323 | * txUpdateMap() resets XAD_NEW in XAD. |
1324 | */ | 1324 | */ |
@@ -1326,7 +1326,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1326 | txUpdateMap(tblk); | 1326 | txUpdateMap(tblk); |
1327 | 1327 | ||
1328 | /* | 1328 | /* |
1329 | * free transaction locks and pageout/free pages | 1329 | * free transaction locks and pageout/free pages |
1330 | */ | 1330 | */ |
1331 | txRelease(tblk); | 1331 | txRelease(tblk); |
1332 | 1332 | ||
@@ -1335,7 +1335,7 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1335 | 1335 | ||
1336 | 1336 | ||
1337 | /* | 1337 | /* |
1338 | * reset in-memory object state | 1338 | * reset in-memory object state |
1339 | */ | 1339 | */ |
1340 | for (k = 0; k < cd.nip; k++) { | 1340 | for (k = 0; k < cd.nip; k++) { |
1341 | ip = cd.iplist[k]; | 1341 | ip = cd.iplist[k]; |
@@ -1358,11 +1358,11 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | /* | 1360 | /* |
1361 | * NAME: txLog() | 1361 | * NAME: txLog() |
1362 | * | 1362 | * |
1363 | * FUNCTION: Writes AFTER log records for all lines modified | 1363 | * FUNCTION: Writes AFTER log records for all lines modified |
1364 | * by tid for segments specified by inodes in comdata. | 1364 | * by tid for segments specified by inodes in comdata. |
1365 | * Code assumes only WRITELOCKS are recorded in lockwords. | 1365 | * Code assumes only WRITELOCKS are recorded in lockwords. |
1366 | * | 1366 | * |
1367 | * PARAMETERS: | 1367 | * PARAMETERS: |
1368 | * | 1368 | * |
@@ -1421,12 +1421,12 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd) | |||
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | /* | 1423 | /* |
1424 | * diLog() | 1424 | * diLog() |
1425 | * | 1425 | * |
1426 | * function: log inode tlock and format maplock to update bmap; | 1426 | * function: log inode tlock and format maplock to update bmap; |
1427 | */ | 1427 | */ |
1428 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | 1428 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
1429 | struct tlock * tlck, struct commit * cd) | 1429 | struct tlock * tlck, struct commit * cd) |
1430 | { | 1430 | { |
1431 | int rc = 0; | 1431 | int rc = 0; |
1432 | struct metapage *mp; | 1432 | struct metapage *mp; |
@@ -1442,7 +1442,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1442 | pxd = &lrd->log.redopage.pxd; | 1442 | pxd = &lrd->log.redopage.pxd; |
1443 | 1443 | ||
1444 | /* | 1444 | /* |
1445 | * inode after image | 1445 | * inode after image |
1446 | */ | 1446 | */ |
1447 | if (tlck->type & tlckENTRY) { | 1447 | if (tlck->type & tlckENTRY) { |
1448 | /* log after-image for logredo(): */ | 1448 | /* log after-image for logredo(): */ |
@@ -1456,7 +1456,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1456 | tlck->flag |= tlckWRITEPAGE; | 1456 | tlck->flag |= tlckWRITEPAGE; |
1457 | } else if (tlck->type & tlckFREE) { | 1457 | } else if (tlck->type & tlckFREE) { |
1458 | /* | 1458 | /* |
1459 | * free inode extent | 1459 | * free inode extent |
1460 | * | 1460 | * |
1461 | * (pages of the freed inode extent have been invalidated and | 1461 | * (pages of the freed inode extent have been invalidated and |
1462 | * a maplock for free of the extent has been formatted at | 1462 | * a maplock for free of the extent has been formatted at |
@@ -1498,7 +1498,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1498 | jfs_err("diLog: UFO type tlck:0x%p", tlck); | 1498 | jfs_err("diLog: UFO type tlck:0x%p", tlck); |
1499 | #ifdef _JFS_WIP | 1499 | #ifdef _JFS_WIP |
1500 | /* | 1500 | /* |
1501 | * alloc/free external EA extent | 1501 | * alloc/free external EA extent |
1502 | * | 1502 | * |
1503 | * a maplock for txUpdateMap() to update bPWMAP for alloc/free | 1503 | * a maplock for txUpdateMap() to update bPWMAP for alloc/free |
1504 | * of the extent has been formatted at txLock() time; | 1504 | * of the extent has been formatted at txLock() time; |
@@ -1534,9 +1534,9 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1534 | } | 1534 | } |
1535 | 1535 | ||
1536 | /* | 1536 | /* |
1537 | * dataLog() | 1537 | * dataLog() |
1538 | * | 1538 | * |
1539 | * function: log data tlock | 1539 | * function: log data tlock |
1540 | */ | 1540 | */ |
1541 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | 1541 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
1542 | struct tlock * tlck) | 1542 | struct tlock * tlck) |
@@ -1580,9 +1580,9 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | /* | 1582 | /* |
1583 | * dtLog() | 1583 | * dtLog() |
1584 | * | 1584 | * |
1585 | * function: log dtree tlock and format maplock to update bmap; | 1585 | * function: log dtree tlock and format maplock to update bmap; |
1586 | */ | 1586 | */ |
1587 | static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | 1587 | static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
1588 | struct tlock * tlck) | 1588 | struct tlock * tlck) |
@@ -1603,10 +1603,10 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1603 | lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT); | 1603 | lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT); |
1604 | 1604 | ||
1605 | /* | 1605 | /* |
1606 | * page extension via relocation: entry insertion; | 1606 | * page extension via relocation: entry insertion; |
1607 | * page extension in-place: entry insertion; | 1607 | * page extension in-place: entry insertion; |
1608 | * new right page from page split, reinitialized in-line | 1608 | * new right page from page split, reinitialized in-line |
1609 | * root from root page split: entry insertion; | 1609 | * root from root page split: entry insertion; |
1610 | */ | 1610 | */ |
1611 | if (tlck->type & (tlckNEW | tlckEXTEND)) { | 1611 | if (tlck->type & (tlckNEW | tlckEXTEND)) { |
1612 | /* log after-image of the new page for logredo(): | 1612 | /* log after-image of the new page for logredo(): |
@@ -1641,8 +1641,8 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1641 | } | 1641 | } |
1642 | 1642 | ||
1643 | /* | 1643 | /* |
1644 | * entry insertion/deletion, | 1644 | * entry insertion/deletion, |
1645 | * sibling page link update (old right page before split); | 1645 | * sibling page link update (old right page before split); |
1646 | */ | 1646 | */ |
1647 | if (tlck->type & (tlckENTRY | tlckRELINK)) { | 1647 | if (tlck->type & (tlckENTRY | tlckRELINK)) { |
1648 | /* log after-image for logredo(): */ | 1648 | /* log after-image for logredo(): */ |
@@ -1658,11 +1658,11 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | /* | 1660 | /* |
1661 | * page deletion: page has been invalidated | 1661 | * page deletion: page has been invalidated |
1662 | * page relocation: source extent | 1662 | * page relocation: source extent |
1663 | * | 1663 | * |
1664 | * a maplock for free of the page has been formatted | 1664 | * a maplock for free of the page has been formatted |
1665 | * at txLock() time); | 1665 | * at txLock() time); |
1666 | */ | 1666 | */ |
1667 | if (tlck->type & (tlckFREE | tlckRELOCATE)) { | 1667 | if (tlck->type & (tlckFREE | tlckRELOCATE)) { |
1668 | /* log LOG_NOREDOPAGE of the deleted page for logredo() | 1668 | /* log LOG_NOREDOPAGE of the deleted page for logredo() |
@@ -1683,9 +1683,9 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | /* | 1685 | /* |
1686 | * xtLog() | 1686 | * xtLog() |
1687 | * | 1687 | * |
1688 | * function: log xtree tlock and format maplock to update bmap; | 1688 | * function: log xtree tlock and format maplock to update bmap; |
1689 | */ | 1689 | */ |
1690 | static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | 1690 | static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
1691 | struct tlock * tlck) | 1691 | struct tlock * tlck) |
@@ -1725,8 +1725,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1725 | xadlock = (struct xdlistlock *) maplock; | 1725 | xadlock = (struct xdlistlock *) maplock; |
1726 | 1726 | ||
1727 | /* | 1727 | /* |
1728 | * entry insertion/extension; | 1728 | * entry insertion/extension; |
1729 | * sibling page link update (old right page before split); | 1729 | * sibling page link update (old right page before split); |
1730 | */ | 1730 | */ |
1731 | if (tlck->type & (tlckNEW | tlckGROW | tlckRELINK)) { | 1731 | if (tlck->type & (tlckNEW | tlckGROW | tlckRELINK)) { |
1732 | /* log after-image for logredo(): | 1732 | /* log after-image for logredo(): |
@@ -1801,7 +1801,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | /* | 1803 | /* |
1804 | * page deletion: file deletion/truncation (ref. xtTruncate()) | 1804 | * page deletion: file deletion/truncation (ref. xtTruncate()) |
1805 | * | 1805 | * |
1806 | * (page will be invalidated after log is written and bmap | 1806 | * (page will be invalidated after log is written and bmap |
1807 | * is updated from the page); | 1807 | * is updated from the page); |
@@ -1908,13 +1908,13 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | /* | 1910 | /* |
1911 | * page/entry truncation: file truncation (ref. xtTruncate()) | 1911 | * page/entry truncation: file truncation (ref. xtTruncate()) |
1912 | * | 1912 | * |
1913 | * |----------+------+------+---------------| | 1913 | * |----------+------+------+---------------| |
1914 | * | | | | 1914 | * | | | |
1915 | * | | hwm - hwm before truncation | 1915 | * | | hwm - hwm before truncation |
1916 | * | next - truncation point | 1916 | * | next - truncation point |
1917 | * lwm - lwm before truncation | 1917 | * lwm - lwm before truncation |
1918 | * header ? | 1918 | * header ? |
1919 | */ | 1919 | */ |
1920 | if (tlck->type & tlckTRUNCATE) { | 1920 | if (tlck->type & tlckTRUNCATE) { |
@@ -1937,7 +1937,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1937 | twm = xtlck->twm.offset; | 1937 | twm = xtlck->twm.offset; |
1938 | 1938 | ||
1939 | /* | 1939 | /* |
1940 | * write log records | 1940 | * write log records |
1941 | */ | 1941 | */ |
1942 | /* log after-image for logredo(): | 1942 | /* log after-image for logredo(): |
1943 | * | 1943 | * |
@@ -1997,7 +1997,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1997 | } | 1997 | } |
1998 | 1998 | ||
1999 | /* | 1999 | /* |
2000 | * format maplock(s) for txUpdateMap() to update bmap | 2000 | * format maplock(s) for txUpdateMap() to update bmap |
2001 | */ | 2001 | */ |
2002 | maplock->index = 0; | 2002 | maplock->index = 0; |
2003 | 2003 | ||
@@ -2069,9 +2069,9 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2069 | } | 2069 | } |
2070 | 2070 | ||
2071 | /* | 2071 | /* |
2072 | * mapLog() | 2072 | * mapLog() |
2073 | * | 2073 | * |
2074 | * function: log from maplock of freed data extents; | 2074 | * function: log from maplock of freed data extents; |
2075 | */ | 2075 | */ |
2076 | static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | 2076 | static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, |
2077 | struct tlock * tlck) | 2077 | struct tlock * tlck) |
@@ -2081,7 +2081,7 @@ static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2081 | pxd_t *pxd; | 2081 | pxd_t *pxd; |
2082 | 2082 | ||
2083 | /* | 2083 | /* |
2084 | * page relocation: free the source page extent | 2084 | * page relocation: free the source page extent |
2085 | * | 2085 | * |
2086 | * a maplock for txUpdateMap() for free of the page | 2086 | * a maplock for txUpdateMap() for free of the page |
2087 | * has been formatted at txLock() time saving the src | 2087 | * has been formatted at txLock() time saving the src |
@@ -2155,10 +2155,10 @@ static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | /* | 2157 | /* |
2158 | * txEA() | 2158 | * txEA() |
2159 | * | 2159 | * |
2160 | * function: acquire maplock for EA/ACL extents or | 2160 | * function: acquire maplock for EA/ACL extents or |
2161 | * set COMMIT_INLINE flag; | 2161 | * set COMMIT_INLINE flag; |
2162 | */ | 2162 | */ |
2163 | void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) | 2163 | void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) |
2164 | { | 2164 | { |
@@ -2207,10 +2207,10 @@ void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) | |||
2207 | } | 2207 | } |
2208 | 2208 | ||
2209 | /* | 2209 | /* |
2210 | * txForce() | 2210 | * txForce() |
2211 | * | 2211 | * |
2212 | * function: synchronously write pages locked by transaction | 2212 | * function: synchronously write pages locked by transaction |
2213 | * after txLog() but before txUpdateMap(); | 2213 | * after txLog() but before txUpdateMap(); |
2214 | */ | 2214 | */ |
2215 | static void txForce(struct tblock * tblk) | 2215 | static void txForce(struct tblock * tblk) |
2216 | { | 2216 | { |
@@ -2273,10 +2273,10 @@ static void txForce(struct tblock * tblk) | |||
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | /* | 2275 | /* |
2276 | * txUpdateMap() | 2276 | * txUpdateMap() |
2277 | * | 2277 | * |
2278 | * function: update persistent allocation map (and working map | 2278 | * function: update persistent allocation map (and working map |
2279 | * if appropriate); | 2279 | * if appropriate); |
2280 | * | 2280 | * |
2281 | * parameter: | 2281 | * parameter: |
2282 | */ | 2282 | */ |
@@ -2298,7 +2298,7 @@ static void txUpdateMap(struct tblock * tblk) | |||
2298 | 2298 | ||
2299 | 2299 | ||
2300 | /* | 2300 | /* |
2301 | * update block allocation map | 2301 | * update block allocation map |
2302 | * | 2302 | * |
2303 | * update allocation state in pmap (and wmap) and | 2303 | * update allocation state in pmap (and wmap) and |
2304 | * update lsn of the pmap page; | 2304 | * update lsn of the pmap page; |
@@ -2382,7 +2382,7 @@ static void txUpdateMap(struct tblock * tblk) | |||
2382 | } | 2382 | } |
2383 | } | 2383 | } |
2384 | /* | 2384 | /* |
2385 | * update inode allocation map | 2385 | * update inode allocation map |
2386 | * | 2386 | * |
2387 | * update allocation state in pmap and | 2387 | * update allocation state in pmap and |
2388 | * update lsn of the pmap page; | 2388 | * update lsn of the pmap page; |
@@ -2407,24 +2407,24 @@ static void txUpdateMap(struct tblock * tblk) | |||
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | /* | 2409 | /* |
2410 | * txAllocPMap() | 2410 | * txAllocPMap() |
2411 | * | 2411 | * |
2412 | * function: allocate from persistent map; | 2412 | * function: allocate from persistent map; |
2413 | * | 2413 | * |
2414 | * parameter: | 2414 | * parameter: |
2415 | * ipbmap - | 2415 | * ipbmap - |
2416 | * malock - | 2416 | * malock - |
2417 | * xad list: | 2417 | * xad list: |
2418 | * pxd: | 2418 | * pxd: |
2419 | * | 2419 | * |
2420 | * maptype - | 2420 | * maptype - |
2421 | * allocate from persistent map; | 2421 | * allocate from persistent map; |
2422 | * free from persistent map; | 2422 | * free from persistent map; |
2423 | * (e.g., tmp file - free from working map at releae | 2423 | * (e.g., tmp file - free from working map at releae |
2424 | * of last reference); | 2424 | * of last reference); |
2425 | * free from persistent and working map; | 2425 | * free from persistent and working map; |
2426 | * | 2426 | * |
2427 | * lsn - log sequence number; | 2427 | * lsn - log sequence number; |
2428 | */ | 2428 | */ |
2429 | static void txAllocPMap(struct inode *ip, struct maplock * maplock, | 2429 | static void txAllocPMap(struct inode *ip, struct maplock * maplock, |
2430 | struct tblock * tblk) | 2430 | struct tblock * tblk) |
@@ -2478,9 +2478,9 @@ static void txAllocPMap(struct inode *ip, struct maplock * maplock, | |||
2478 | } | 2478 | } |
2479 | 2479 | ||
2480 | /* | 2480 | /* |
2481 | * txFreeMap() | 2481 | * txFreeMap() |
2482 | * | 2482 | * |
2483 | * function: free from persistent and/or working map; | 2483 | * function: free from persistent and/or working map; |
2484 | * | 2484 | * |
2485 | * todo: optimization | 2485 | * todo: optimization |
2486 | */ | 2486 | */ |
@@ -2579,9 +2579,9 @@ void txFreeMap(struct inode *ip, | |||
2579 | } | 2579 | } |
2580 | 2580 | ||
2581 | /* | 2581 | /* |
2582 | * txFreelock() | 2582 | * txFreelock() |
2583 | * | 2583 | * |
2584 | * function: remove tlock from inode anonymous locklist | 2584 | * function: remove tlock from inode anonymous locklist |
2585 | */ | 2585 | */ |
2586 | void txFreelock(struct inode *ip) | 2586 | void txFreelock(struct inode *ip) |
2587 | { | 2587 | { |
@@ -2619,7 +2619,7 @@ void txFreelock(struct inode *ip) | |||
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | /* | 2621 | /* |
2622 | * txAbort() | 2622 | * txAbort() |
2623 | * | 2623 | * |
2624 | * function: abort tx before commit; | 2624 | * function: abort tx before commit; |
2625 | * | 2625 | * |
@@ -2679,7 +2679,7 @@ void txAbort(tid_t tid, int dirty) | |||
2679 | } | 2679 | } |
2680 | 2680 | ||
2681 | /* | 2681 | /* |
2682 | * txLazyCommit(void) | 2682 | * txLazyCommit(void) |
2683 | * | 2683 | * |
2684 | * All transactions except those changing ipimap (COMMIT_FORCE) are | 2684 | * All transactions except those changing ipimap (COMMIT_FORCE) are |
2685 | * processed by this routine. This insures that the inode and block | 2685 | * processed by this routine. This insures that the inode and block |
@@ -2728,7 +2728,7 @@ static void txLazyCommit(struct tblock * tblk) | |||
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | /* | 2730 | /* |
2731 | * jfs_lazycommit(void) | 2731 | * jfs_lazycommit(void) |
2732 | * | 2732 | * |
2733 | * To be run as a kernel daemon. If lbmIODone is called in an interrupt | 2733 | * To be run as a kernel daemon. If lbmIODone is called in an interrupt |
2734 | * context, or where blocking is not wanted, this routine will process | 2734 | * context, or where blocking is not wanted, this routine will process |
@@ -2913,7 +2913,7 @@ void txResume(struct super_block *sb) | |||
2913 | } | 2913 | } |
2914 | 2914 | ||
2915 | /* | 2915 | /* |
2916 | * jfs_sync(void) | 2916 | * jfs_sync(void) |
2917 | * | 2917 | * |
2918 | * To be run as a kernel daemon. This is awakened when tlocks run low. | 2918 | * To be run as a kernel daemon. This is awakened when tlocks run low. |
2919 | * We write any inodes that have anonymous tlocks so they will become | 2919 | * We write any inodes that have anonymous tlocks so they will become |
diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h index 7863cf21afca..ab7288937019 100644 --- a/fs/jfs/jfs_txnmgr.h +++ b/fs/jfs/jfs_txnmgr.h | |||
@@ -94,7 +94,7 @@ extern struct tblock *TxBlock; /* transaction block table */ | |||
94 | */ | 94 | */ |
95 | struct tlock { | 95 | struct tlock { |
96 | lid_t next; /* 2: index next lockword on tid locklist | 96 | lid_t next; /* 2: index next lockword on tid locklist |
97 | * next lockword on freelist | 97 | * next lockword on freelist |
98 | */ | 98 | */ |
99 | tid_t tid; /* 2: transaction id holding lock */ | 99 | tid_t tid; /* 2: transaction id holding lock */ |
100 | 100 | ||
diff --git a/fs/jfs/jfs_types.h b/fs/jfs/jfs_types.h index 09b252958687..649f9817accd 100644 --- a/fs/jfs/jfs_types.h +++ b/fs/jfs/jfs_types.h | |||
@@ -21,7 +21,7 @@ | |||
21 | /* | 21 | /* |
22 | * jfs_types.h: | 22 | * jfs_types.h: |
23 | * | 23 | * |
24 | * basic type/utility definitions | 24 | * basic type/utility definitions |
25 | * | 25 | * |
26 | * note: this header file must be the 1st include file | 26 | * note: this header file must be the 1st include file |
27 | * of JFS include list in all JFS .c file. | 27 | * of JFS include list in all JFS .c file. |
@@ -54,8 +54,8 @@ struct timestruc_t { | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #define LEFTMOSTONE 0x80000000 | 56 | #define LEFTMOSTONE 0x80000000 |
57 | #define HIGHORDER 0x80000000u /* high order bit on */ | 57 | #define HIGHORDER 0x80000000u /* high order bit on */ |
58 | #define ONES 0xffffffffu /* all bit on */ | 58 | #define ONES 0xffffffffu /* all bit on */ |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * logical xd (lxd) | 61 | * logical xd (lxd) |
@@ -148,7 +148,7 @@ typedef struct { | |||
148 | #define sizeDXD(dxd) le32_to_cpu((dxd)->size) | 148 | #define sizeDXD(dxd) le32_to_cpu((dxd)->size) |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * directory entry argument | 151 | * directory entry argument |
152 | */ | 152 | */ |
153 | struct component_name { | 153 | struct component_name { |
154 | int namlen; | 154 | int namlen; |
@@ -160,14 +160,14 @@ struct component_name { | |||
160 | * DASD limit information - stored in directory inode | 160 | * DASD limit information - stored in directory inode |
161 | */ | 161 | */ |
162 | struct dasd { | 162 | struct dasd { |
163 | u8 thresh; /* Alert Threshold (in percent) */ | 163 | u8 thresh; /* Alert Threshold (in percent) */ |
164 | u8 delta; /* Alert Threshold delta (in percent) */ | 164 | u8 delta; /* Alert Threshold delta (in percent) */ |
165 | u8 rsrvd1; | 165 | u8 rsrvd1; |
166 | u8 limit_hi; /* DASD limit (in logical blocks) */ | 166 | u8 limit_hi; /* DASD limit (in logical blocks) */ |
167 | __le32 limit_lo; /* DASD limit (in logical blocks) */ | 167 | __le32 limit_lo; /* DASD limit (in logical blocks) */ |
168 | u8 rsrvd2[3]; | 168 | u8 rsrvd2[3]; |
169 | u8 used_hi; /* DASD usage (in logical blocks) */ | 169 | u8 used_hi; /* DASD usage (in logical blocks) */ |
170 | __le32 used_lo; /* DASD usage (in logical blocks) */ | 170 | __le32 used_lo; /* DASD usage (in logical blocks) */ |
171 | }; | 171 | }; |
172 | 172 | ||
173 | #define DASDLIMIT(dasdp) \ | 173 | #define DASDLIMIT(dasdp) \ |
diff --git a/fs/jfs/jfs_umount.c b/fs/jfs/jfs_umount.c index a386f48c73fc..7971f37534a3 100644 --- a/fs/jfs/jfs_umount.c +++ b/fs/jfs/jfs_umount.c | |||
@@ -60,7 +60,7 @@ int jfs_umount(struct super_block *sb) | |||
60 | jfs_info("UnMount JFS: sb:0x%p", sb); | 60 | jfs_info("UnMount JFS: sb:0x%p", sb); |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * update superblock and close log | 63 | * update superblock and close log |
64 | * | 64 | * |
65 | * if mounted read-write and log based recovery was enabled | 65 | * if mounted read-write and log based recovery was enabled |
66 | */ | 66 | */ |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index acc97c46d8a4..1543906a2e0d 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
@@ -16,7 +16,7 @@ | |||
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 | /* |
19 | * jfs_xtree.c: extent allocation descriptor B+-tree manager | 19 | * jfs_xtree.c: extent allocation descriptor B+-tree manager |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
@@ -32,30 +32,30 @@ | |||
32 | /* | 32 | /* |
33 | * xtree local flag | 33 | * xtree local flag |
34 | */ | 34 | */ |
35 | #define XT_INSERT 0x00000001 | 35 | #define XT_INSERT 0x00000001 |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * xtree key/entry comparison: extent offset | 38 | * xtree key/entry comparison: extent offset |
39 | * | 39 | * |
40 | * return: | 40 | * return: |
41 | * -1: k < start of extent | 41 | * -1: k < start of extent |
42 | * 0: start_of_extent <= k <= end_of_extent | 42 | * 0: start_of_extent <= k <= end_of_extent |
43 | * 1: k > end_of_extent | 43 | * 1: k > end_of_extent |
44 | */ | 44 | */ |
45 | #define XT_CMP(CMP, K, X, OFFSET64)\ | 45 | #define XT_CMP(CMP, K, X, OFFSET64)\ |
46 | {\ | 46 | {\ |
47 | OFFSET64 = offsetXAD(X);\ | 47 | OFFSET64 = offsetXAD(X);\ |
48 | (CMP) = ((K) >= OFFSET64 + lengthXAD(X)) ? 1 :\ | 48 | (CMP) = ((K) >= OFFSET64 + lengthXAD(X)) ? 1 :\ |
49 | ((K) < OFFSET64) ? -1 : 0;\ | 49 | ((K) < OFFSET64) ? -1 : 0;\ |
50 | } | 50 | } |
51 | 51 | ||
52 | /* write a xad entry */ | 52 | /* write a xad entry */ |
53 | #define XT_PUTENTRY(XAD, FLAG, OFF, LEN, ADDR)\ | 53 | #define XT_PUTENTRY(XAD, FLAG, OFF, LEN, ADDR)\ |
54 | {\ | 54 | {\ |
55 | (XAD)->flag = (FLAG);\ | 55 | (XAD)->flag = (FLAG);\ |
56 | XADoffset((XAD), (OFF));\ | 56 | XADoffset((XAD), (OFF));\ |
57 | XADlength((XAD), (LEN));\ | 57 | XADlength((XAD), (LEN));\ |
58 | XADaddress((XAD), (ADDR));\ | 58 | XADaddress((XAD), (ADDR));\ |
59 | } | 59 | } |
60 | 60 | ||
61 | #define XT_PAGE(IP, MP) BT_PAGE(IP, MP, xtpage_t, i_xtroot) | 61 | #define XT_PAGE(IP, MP) BT_PAGE(IP, MP, xtpage_t, i_xtroot) |
@@ -76,13 +76,13 @@ | |||
76 | MP = NULL;\ | 76 | MP = NULL;\ |
77 | RC = -EIO;\ | 77 | RC = -EIO;\ |
78 | }\ | 78 | }\ |
79 | }\ | 79 | }\ |
80 | } | 80 | } |
81 | 81 | ||
82 | /* for consistency */ | 82 | /* for consistency */ |
83 | #define XT_PUTPAGE(MP) BT_PUTPAGE(MP) | 83 | #define XT_PUTPAGE(MP) BT_PUTPAGE(MP) |
84 | 84 | ||
85 | #define XT_GETSEARCH(IP, LEAF, BN, MP, P, INDEX) \ | 85 | #define XT_GETSEARCH(IP, LEAF, BN, MP, P, INDEX) \ |
86 | BT_GETSEARCH(IP, LEAF, BN, MP, xtpage_t, P, INDEX, i_xtroot) | 86 | BT_GETSEARCH(IP, LEAF, BN, MP, xtpage_t, P, INDEX, i_xtroot) |
87 | /* xtree entry parameter descriptor */ | 87 | /* xtree entry parameter descriptor */ |
88 | struct xtsplit { | 88 | struct xtsplit { |
@@ -97,7 +97,7 @@ struct xtsplit { | |||
97 | 97 | ||
98 | 98 | ||
99 | /* | 99 | /* |
100 | * statistics | 100 | * statistics |
101 | */ | 101 | */ |
102 | #ifdef CONFIG_JFS_STATISTICS | 102 | #ifdef CONFIG_JFS_STATISTICS |
103 | static struct { | 103 | static struct { |
@@ -136,7 +136,7 @@ static int xtRelink(tid_t tid, struct inode *ip, xtpage_t * fp); | |||
136 | #endif /* _STILL_TO_PORT */ | 136 | #endif /* _STILL_TO_PORT */ |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * xtLookup() | 139 | * xtLookup() |
140 | * | 140 | * |
141 | * function: map a single page into a physical extent; | 141 | * function: map a single page into a physical extent; |
142 | */ | 142 | */ |
@@ -179,7 +179,7 @@ int xtLookup(struct inode *ip, s64 lstart, | |||
179 | } | 179 | } |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * compute the physical extent covering logical extent | 182 | * compute the physical extent covering logical extent |
183 | * | 183 | * |
184 | * N.B. search may have failed (e.g., hole in sparse file), | 184 | * N.B. search may have failed (e.g., hole in sparse file), |
185 | * and returned the index of the next entry. | 185 | * and returned the index of the next entry. |
@@ -220,27 +220,27 @@ int xtLookup(struct inode *ip, s64 lstart, | |||
220 | 220 | ||
221 | 221 | ||
222 | /* | 222 | /* |
223 | * xtLookupList() | 223 | * xtLookupList() |
224 | * | 224 | * |
225 | * function: map a single logical extent into a list of physical extent; | 225 | * function: map a single logical extent into a list of physical extent; |
226 | * | 226 | * |
227 | * parameter: | 227 | * parameter: |
228 | * struct inode *ip, | 228 | * struct inode *ip, |
229 | * struct lxdlist *lxdlist, lxd list (in) | 229 | * struct lxdlist *lxdlist, lxd list (in) |
230 | * struct xadlist *xadlist, xad list (in/out) | 230 | * struct xadlist *xadlist, xad list (in/out) |
231 | * int flag) | 231 | * int flag) |
232 | * | 232 | * |
233 | * coverage of lxd by xad under assumption of | 233 | * coverage of lxd by xad under assumption of |
234 | * . lxd's are ordered and disjoint. | 234 | * . lxd's are ordered and disjoint. |
235 | * . xad's are ordered and disjoint. | 235 | * . xad's are ordered and disjoint. |
236 | * | 236 | * |
237 | * return: | 237 | * return: |
238 | * 0: success | 238 | * 0: success |
239 | * | 239 | * |
240 | * note: a page being written (even a single byte) is backed fully, | 240 | * note: a page being written (even a single byte) is backed fully, |
241 | * except the last page which is only backed with blocks | 241 | * except the last page which is only backed with blocks |
242 | * required to cover the last byte; | 242 | * required to cover the last byte; |
243 | * the extent backing a page is fully contained within an xad; | 243 | * the extent backing a page is fully contained within an xad; |
244 | */ | 244 | */ |
245 | int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, | 245 | int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, |
246 | struct xadlist * xadlist, int flag) | 246 | struct xadlist * xadlist, int flag) |
@@ -284,7 +284,7 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, | |||
284 | return rc; | 284 | return rc; |
285 | 285 | ||
286 | /* | 286 | /* |
287 | * compute the physical extent covering logical extent | 287 | * compute the physical extent covering logical extent |
288 | * | 288 | * |
289 | * N.B. search may have failed (e.g., hole in sparse file), | 289 | * N.B. search may have failed (e.g., hole in sparse file), |
290 | * and returned the index of the next entry. | 290 | * and returned the index of the next entry. |
@@ -343,7 +343,7 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, | |||
343 | if (lstart >= size) | 343 | if (lstart >= size) |
344 | goto mapend; | 344 | goto mapend; |
345 | 345 | ||
346 | /* compare with the current xad */ | 346 | /* compare with the current xad */ |
347 | goto compare1; | 347 | goto compare1; |
348 | } | 348 | } |
349 | /* lxd is covered by xad */ | 349 | /* lxd is covered by xad */ |
@@ -430,7 +430,7 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, | |||
430 | /* | 430 | /* |
431 | * lxd is partially covered by xad | 431 | * lxd is partially covered by xad |
432 | */ | 432 | */ |
433 | else { /* (xend < lend) */ | 433 | else { /* (xend < lend) */ |
434 | 434 | ||
435 | /* | 435 | /* |
436 | * get next xad | 436 | * get next xad |
@@ -477,22 +477,22 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, | |||
477 | 477 | ||
478 | 478 | ||
479 | /* | 479 | /* |
480 | * xtSearch() | 480 | * xtSearch() |
481 | * | 481 | * |
482 | * function: search for the xad entry covering specified offset. | 482 | * function: search for the xad entry covering specified offset. |
483 | * | 483 | * |
484 | * parameters: | 484 | * parameters: |
485 | * ip - file object; | 485 | * ip - file object; |
486 | * xoff - extent offset; | 486 | * xoff - extent offset; |
487 | * nextp - address of next extent (if any) for search miss | 487 | * nextp - address of next extent (if any) for search miss |
488 | * cmpp - comparison result: | 488 | * cmpp - comparison result: |
489 | * btstack - traverse stack; | 489 | * btstack - traverse stack; |
490 | * flag - search process flag (XT_INSERT); | 490 | * flag - search process flag (XT_INSERT); |
491 | * | 491 | * |
492 | * returns: | 492 | * returns: |
493 | * btstack contains (bn, index) of search path traversed to the entry. | 493 | * btstack contains (bn, index) of search path traversed to the entry. |
494 | * *cmpp is set to result of comparison with the entry returned. | 494 | * *cmpp is set to result of comparison with the entry returned. |
495 | * the page containing the entry is pinned at exit. | 495 | * the page containing the entry is pinned at exit. |
496 | */ | 496 | */ |
497 | static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, | 497 | static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, |
498 | int *cmpp, struct btstack * btstack, int flag) | 498 | int *cmpp, struct btstack * btstack, int flag) |
@@ -517,7 +517,7 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, | |||
517 | btstack->nsplit = 0; | 517 | btstack->nsplit = 0; |
518 | 518 | ||
519 | /* | 519 | /* |
520 | * search down tree from root: | 520 | * search down tree from root: |
521 | * | 521 | * |
522 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of | 522 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of |
523 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. | 523 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. |
@@ -642,7 +642,7 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, | |||
642 | XT_CMP(cmp, xoff, &p->xad[index], t64); | 642 | XT_CMP(cmp, xoff, &p->xad[index], t64); |
643 | if (cmp == 0) { | 643 | if (cmp == 0) { |
644 | /* | 644 | /* |
645 | * search hit | 645 | * search hit |
646 | */ | 646 | */ |
647 | /* search hit - leaf page: | 647 | /* search hit - leaf page: |
648 | * return the entry found | 648 | * return the entry found |
@@ -692,7 +692,7 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, | |||
692 | } | 692 | } |
693 | 693 | ||
694 | /* | 694 | /* |
695 | * search miss | 695 | * search miss |
696 | * | 696 | * |
697 | * base is the smallest index with key (Kj) greater than | 697 | * base is the smallest index with key (Kj) greater than |
698 | * search key (K) and may be zero or maxentry index. | 698 | * search key (K) and may be zero or maxentry index. |
@@ -773,22 +773,22 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, | |||
773 | } | 773 | } |
774 | 774 | ||
775 | /* | 775 | /* |
776 | * xtInsert() | 776 | * xtInsert() |
777 | * | 777 | * |
778 | * function: | 778 | * function: |
779 | * | 779 | * |
780 | * parameter: | 780 | * parameter: |
781 | * tid - transaction id; | 781 | * tid - transaction id; |
782 | * ip - file object; | 782 | * ip - file object; |
783 | * xflag - extent flag (XAD_NOTRECORDED): | 783 | * xflag - extent flag (XAD_NOTRECORDED): |
784 | * xoff - extent offset; | 784 | * xoff - extent offset; |
785 | * xlen - extent length; | 785 | * xlen - extent length; |
786 | * xaddrp - extent address pointer (in/out): | 786 | * xaddrp - extent address pointer (in/out): |
787 | * if (*xaddrp) | 787 | * if (*xaddrp) |
788 | * caller allocated data extent at *xaddrp; | 788 | * caller allocated data extent at *xaddrp; |
789 | * else | 789 | * else |
790 | * allocate data extent and return its xaddr; | 790 | * allocate data extent and return its xaddr; |
791 | * flag - | 791 | * flag - |
792 | * | 792 | * |
793 | * return: | 793 | * return: |
794 | */ | 794 | */ |
@@ -813,7 +813,7 @@ int xtInsert(tid_t tid, /* transaction id */ | |||
813 | jfs_info("xtInsert: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen); | 813 | jfs_info("xtInsert: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen); |
814 | 814 | ||
815 | /* | 815 | /* |
816 | * search for the entry location at which to insert: | 816 | * search for the entry location at which to insert: |
817 | * | 817 | * |
818 | * xtFastSearch() and xtSearch() both returns (leaf page | 818 | * xtFastSearch() and xtSearch() both returns (leaf page |
819 | * pinned, index at which to insert). | 819 | * pinned, index at which to insert). |
@@ -853,13 +853,13 @@ int xtInsert(tid_t tid, /* transaction id */ | |||
853 | } | 853 | } |
854 | 854 | ||
855 | /* | 855 | /* |
856 | * insert entry for new extent | 856 | * insert entry for new extent |
857 | */ | 857 | */ |
858 | xflag |= XAD_NEW; | 858 | xflag |= XAD_NEW; |
859 | 859 | ||
860 | /* | 860 | /* |
861 | * if the leaf page is full, split the page and | 861 | * if the leaf page is full, split the page and |
862 | * propagate up the router entry for the new page from split | 862 | * propagate up the router entry for the new page from split |
863 | * | 863 | * |
864 | * The xtSplitUp() will insert the entry and unpin the leaf page. | 864 | * The xtSplitUp() will insert the entry and unpin the leaf page. |
865 | */ | 865 | */ |
@@ -886,7 +886,7 @@ int xtInsert(tid_t tid, /* transaction id */ | |||
886 | } | 886 | } |
887 | 887 | ||
888 | /* | 888 | /* |
889 | * insert the new entry into the leaf page | 889 | * insert the new entry into the leaf page |
890 | */ | 890 | */ |
891 | /* | 891 | /* |
892 | * acquire a transaction lock on the leaf page; | 892 | * acquire a transaction lock on the leaf page; |
@@ -930,16 +930,16 @@ int xtInsert(tid_t tid, /* transaction id */ | |||
930 | 930 | ||
931 | 931 | ||
932 | /* | 932 | /* |
933 | * xtSplitUp() | 933 | * xtSplitUp() |
934 | * | 934 | * |
935 | * function: | 935 | * function: |
936 | * split full pages as propagating insertion up the tree | 936 | * split full pages as propagating insertion up the tree |
937 | * | 937 | * |
938 | * parameter: | 938 | * parameter: |
939 | * tid - transaction id; | 939 | * tid - transaction id; |
940 | * ip - file object; | 940 | * ip - file object; |
941 | * split - entry parameter descriptor; | 941 | * split - entry parameter descriptor; |
942 | * btstack - traverse stack from xtSearch() | 942 | * btstack - traverse stack from xtSearch() |
943 | * | 943 | * |
944 | * return: | 944 | * return: |
945 | */ | 945 | */ |
@@ -1199,22 +1199,22 @@ xtSplitUp(tid_t tid, | |||
1199 | 1199 | ||
1200 | 1200 | ||
1201 | /* | 1201 | /* |
1202 | * xtSplitPage() | 1202 | * xtSplitPage() |
1203 | * | 1203 | * |
1204 | * function: | 1204 | * function: |
1205 | * split a full non-root page into | 1205 | * split a full non-root page into |
1206 | * original/split/left page and new right page | 1206 | * original/split/left page and new right page |
1207 | * i.e., the original/split page remains as left page. | 1207 | * i.e., the original/split page remains as left page. |
1208 | * | 1208 | * |
1209 | * parameter: | 1209 | * parameter: |
1210 | * int tid, | 1210 | * int tid, |
1211 | * struct inode *ip, | 1211 | * struct inode *ip, |
1212 | * struct xtsplit *split, | 1212 | * struct xtsplit *split, |
1213 | * struct metapage **rmpp, | 1213 | * struct metapage **rmpp, |
1214 | * u64 *rbnp, | 1214 | * u64 *rbnp, |
1215 | * | 1215 | * |
1216 | * return: | 1216 | * return: |
1217 | * Pointer to page in which to insert or NULL on error. | 1217 | * Pointer to page in which to insert or NULL on error. |
1218 | */ | 1218 | */ |
1219 | static int | 1219 | static int |
1220 | xtSplitPage(tid_t tid, struct inode *ip, | 1220 | xtSplitPage(tid_t tid, struct inode *ip, |
@@ -1248,9 +1248,9 @@ xtSplitPage(tid_t tid, struct inode *ip, | |||
1248 | rbn = addressPXD(pxd); | 1248 | rbn = addressPXD(pxd); |
1249 | 1249 | ||
1250 | /* Allocate blocks to quota. */ | 1250 | /* Allocate blocks to quota. */ |
1251 | if (DQUOT_ALLOC_BLOCK(ip, lengthPXD(pxd))) { | 1251 | if (DQUOT_ALLOC_BLOCK(ip, lengthPXD(pxd))) { |
1252 | rc = -EDQUOT; | 1252 | rc = -EDQUOT; |
1253 | goto clean_up; | 1253 | goto clean_up; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | quota_allocation += lengthPXD(pxd); | 1256 | quota_allocation += lengthPXD(pxd); |
@@ -1304,7 +1304,7 @@ xtSplitPage(tid_t tid, struct inode *ip, | |||
1304 | skip = split->index; | 1304 | skip = split->index; |
1305 | 1305 | ||
1306 | /* | 1306 | /* |
1307 | * sequential append at tail (after last entry of last page) | 1307 | * sequential append at tail (after last entry of last page) |
1308 | * | 1308 | * |
1309 | * if splitting the last page on a level because of appending | 1309 | * if splitting the last page on a level because of appending |
1310 | * a entry to it (skip is maxentry), it's likely that the access is | 1310 | * a entry to it (skip is maxentry), it's likely that the access is |
@@ -1342,7 +1342,7 @@ xtSplitPage(tid_t tid, struct inode *ip, | |||
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | /* | 1344 | /* |
1345 | * non-sequential insert (at possibly middle page) | 1345 | * non-sequential insert (at possibly middle page) |
1346 | */ | 1346 | */ |
1347 | 1347 | ||
1348 | /* | 1348 | /* |
@@ -1465,25 +1465,24 @@ xtSplitPage(tid_t tid, struct inode *ip, | |||
1465 | 1465 | ||
1466 | 1466 | ||
1467 | /* | 1467 | /* |
1468 | * xtSplitRoot() | 1468 | * xtSplitRoot() |
1469 | * | 1469 | * |
1470 | * function: | 1470 | * function: |
1471 | * split the full root page into | 1471 | * split the full root page into original/root/split page and new |
1472 | * original/root/split page and new right page | 1472 | * right page |
1473 | * i.e., root remains fixed in tree anchor (inode) and | 1473 | * i.e., root remains fixed in tree anchor (inode) and the root is |
1474 | * the root is copied to a single new right child page | 1474 | * copied to a single new right child page since root page << |
1475 | * since root page << non-root page, and | 1475 | * non-root page, and the split root page contains a single entry |
1476 | * the split root page contains a single entry for the | 1476 | * for the new right child page. |
1477 | * new right child page. | ||
1478 | * | 1477 | * |
1479 | * parameter: | 1478 | * parameter: |
1480 | * int tid, | 1479 | * int tid, |
1481 | * struct inode *ip, | 1480 | * struct inode *ip, |
1482 | * struct xtsplit *split, | 1481 | * struct xtsplit *split, |
1483 | * struct metapage **rmpp) | 1482 | * struct metapage **rmpp) |
1484 | * | 1483 | * |
1485 | * return: | 1484 | * return: |
1486 | * Pointer to page in which to insert or NULL on error. | 1485 | * Pointer to page in which to insert or NULL on error. |
1487 | */ | 1486 | */ |
1488 | static int | 1487 | static int |
1489 | xtSplitRoot(tid_t tid, | 1488 | xtSplitRoot(tid_t tid, |
@@ -1505,7 +1504,7 @@ xtSplitRoot(tid_t tid, | |||
1505 | INCREMENT(xtStat.split); | 1504 | INCREMENT(xtStat.split); |
1506 | 1505 | ||
1507 | /* | 1506 | /* |
1508 | * allocate a single (right) child page | 1507 | * allocate a single (right) child page |
1509 | */ | 1508 | */ |
1510 | pxdlist = split->pxdlist; | 1509 | pxdlist = split->pxdlist; |
1511 | pxd = &pxdlist->pxd[pxdlist->npxd]; | 1510 | pxd = &pxdlist->pxd[pxdlist->npxd]; |
@@ -1573,7 +1572,7 @@ xtSplitRoot(tid_t tid, | |||
1573 | } | 1572 | } |
1574 | 1573 | ||
1575 | /* | 1574 | /* |
1576 | * reset the root | 1575 | * reset the root |
1577 | * | 1576 | * |
1578 | * init root with the single entry for the new right page | 1577 | * init root with the single entry for the new right page |
1579 | * set the 1st entry offset to 0, which force the left-most key | 1578 | * set the 1st entry offset to 0, which force the left-most key |
@@ -1610,7 +1609,7 @@ xtSplitRoot(tid_t tid, | |||
1610 | 1609 | ||
1611 | 1610 | ||
1612 | /* | 1611 | /* |
1613 | * xtExtend() | 1612 | * xtExtend() |
1614 | * | 1613 | * |
1615 | * function: extend in-place; | 1614 | * function: extend in-place; |
1616 | * | 1615 | * |
@@ -1677,7 +1676,7 @@ int xtExtend(tid_t tid, /* transaction id */ | |||
1677 | goto extendOld; | 1676 | goto extendOld; |
1678 | 1677 | ||
1679 | /* | 1678 | /* |
1680 | * extent overflow: insert entry for new extent | 1679 | * extent overflow: insert entry for new extent |
1681 | */ | 1680 | */ |
1682 | //insertNew: | 1681 | //insertNew: |
1683 | xoff = offsetXAD(xad) + MAXXLEN; | 1682 | xoff = offsetXAD(xad) + MAXXLEN; |
@@ -1685,8 +1684,8 @@ int xtExtend(tid_t tid, /* transaction id */ | |||
1685 | nextindex = le16_to_cpu(p->header.nextindex); | 1684 | nextindex = le16_to_cpu(p->header.nextindex); |
1686 | 1685 | ||
1687 | /* | 1686 | /* |
1688 | * if the leaf page is full, insert the new entry and | 1687 | * if the leaf page is full, insert the new entry and |
1689 | * propagate up the router entry for the new page from split | 1688 | * propagate up the router entry for the new page from split |
1690 | * | 1689 | * |
1691 | * The xtSplitUp() will insert the entry and unpin the leaf page. | 1690 | * The xtSplitUp() will insert the entry and unpin the leaf page. |
1692 | */ | 1691 | */ |
@@ -1731,7 +1730,7 @@ int xtExtend(tid_t tid, /* transaction id */ | |||
1731 | } | 1730 | } |
1732 | } | 1731 | } |
1733 | /* | 1732 | /* |
1734 | * insert the new entry into the leaf page | 1733 | * insert the new entry into the leaf page |
1735 | */ | 1734 | */ |
1736 | else { | 1735 | else { |
1737 | /* insert the new entry: mark the entry NEW */ | 1736 | /* insert the new entry: mark the entry NEW */ |
@@ -1771,11 +1770,11 @@ int xtExtend(tid_t tid, /* transaction id */ | |||
1771 | 1770 | ||
1772 | #ifdef _NOTYET | 1771 | #ifdef _NOTYET |
1773 | /* | 1772 | /* |
1774 | * xtTailgate() | 1773 | * xtTailgate() |
1775 | * | 1774 | * |
1776 | * function: split existing 'tail' extent | 1775 | * function: split existing 'tail' extent |
1777 | * (split offset >= start offset of tail extent), and | 1776 | * (split offset >= start offset of tail extent), and |
1778 | * relocate and extend the split tail half; | 1777 | * relocate and extend the split tail half; |
1779 | * | 1778 | * |
1780 | * note: existing extent may or may not have been committed. | 1779 | * note: existing extent may or may not have been committed. |
1781 | * caller is responsible for pager buffer cache update, and | 1780 | * caller is responsible for pager buffer cache update, and |
@@ -1804,7 +1803,7 @@ int xtTailgate(tid_t tid, /* transaction id */ | |||
1804 | 1803 | ||
1805 | /* | 1804 | /* |
1806 | printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n", | 1805 | printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n", |
1807 | (ulong)xoff, xlen, (ulong)xaddr); | 1806 | (ulong)xoff, xlen, (ulong)xaddr); |
1808 | */ | 1807 | */ |
1809 | 1808 | ||
1810 | /* there must exist extent to be tailgated */ | 1809 | /* there must exist extent to be tailgated */ |
@@ -1842,18 +1841,18 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n", | |||
1842 | xad = &p->xad[index]; | 1841 | xad = &p->xad[index]; |
1843 | /* | 1842 | /* |
1844 | printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", | 1843 | printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", |
1845 | (ulong)offsetXAD(xad), lengthXAD(xad), (ulong)addressXAD(xad)); | 1844 | (ulong)offsetXAD(xad), lengthXAD(xad), (ulong)addressXAD(xad)); |
1846 | */ | 1845 | */ |
1847 | if ((llen = xoff - offsetXAD(xad)) == 0) | 1846 | if ((llen = xoff - offsetXAD(xad)) == 0) |
1848 | goto updateOld; | 1847 | goto updateOld; |
1849 | 1848 | ||
1850 | /* | 1849 | /* |
1851 | * partially replace extent: insert entry for new extent | 1850 | * partially replace extent: insert entry for new extent |
1852 | */ | 1851 | */ |
1853 | //insertNew: | 1852 | //insertNew: |
1854 | /* | 1853 | /* |
1855 | * if the leaf page is full, insert the new entry and | 1854 | * if the leaf page is full, insert the new entry and |
1856 | * propagate up the router entry for the new page from split | 1855 | * propagate up the router entry for the new page from split |
1857 | * | 1856 | * |
1858 | * The xtSplitUp() will insert the entry and unpin the leaf page. | 1857 | * The xtSplitUp() will insert the entry and unpin the leaf page. |
1859 | */ | 1858 | */ |
@@ -1898,7 +1897,7 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", | |||
1898 | } | 1897 | } |
1899 | } | 1898 | } |
1900 | /* | 1899 | /* |
1901 | * insert the new entry into the leaf page | 1900 | * insert the new entry into the leaf page |
1902 | */ | 1901 | */ |
1903 | else { | 1902 | else { |
1904 | /* insert the new entry: mark the entry NEW */ | 1903 | /* insert the new entry: mark the entry NEW */ |
@@ -1955,17 +1954,17 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", | |||
1955 | #endif /* _NOTYET */ | 1954 | #endif /* _NOTYET */ |
1956 | 1955 | ||
1957 | /* | 1956 | /* |
1958 | * xtUpdate() | 1957 | * xtUpdate() |
1959 | * | 1958 | * |
1960 | * function: update XAD; | 1959 | * function: update XAD; |
1961 | * | 1960 | * |
1962 | * update extent for allocated_but_not_recorded or | 1961 | * update extent for allocated_but_not_recorded or |
1963 | * compressed extent; | 1962 | * compressed extent; |
1964 | * | 1963 | * |
1965 | * parameter: | 1964 | * parameter: |
1966 | * nxad - new XAD; | 1965 | * nxad - new XAD; |
1967 | * logical extent of the specified XAD must be completely | 1966 | * logical extent of the specified XAD must be completely |
1968 | * contained by an existing XAD; | 1967 | * contained by an existing XAD; |
1969 | */ | 1968 | */ |
1970 | int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) | 1969 | int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) |
1971 | { /* new XAD */ | 1970 | { /* new XAD */ |
@@ -2416,19 +2415,19 @@ printf("xtUpdate.updateLeft.split p:0x%p\n", p); | |||
2416 | 2415 | ||
2417 | 2416 | ||
2418 | /* | 2417 | /* |
2419 | * xtAppend() | 2418 | * xtAppend() |
2420 | * | 2419 | * |
2421 | * function: grow in append mode from contiguous region specified ; | 2420 | * function: grow in append mode from contiguous region specified ; |
2422 | * | 2421 | * |
2423 | * parameter: | 2422 | * parameter: |
2424 | * tid - transaction id; | 2423 | * tid - transaction id; |
2425 | * ip - file object; | 2424 | * ip - file object; |
2426 | * xflag - extent flag: | 2425 | * xflag - extent flag: |
2427 | * xoff - extent offset; | 2426 | * xoff - extent offset; |
2428 | * maxblocks - max extent length; | 2427 | * maxblocks - max extent length; |
2429 | * xlen - extent length (in/out); | 2428 | * xlen - extent length (in/out); |
2430 | * xaddrp - extent address pointer (in/out): | 2429 | * xaddrp - extent address pointer (in/out): |
2431 | * flag - | 2430 | * flag - |
2432 | * | 2431 | * |
2433 | * return: | 2432 | * return: |
2434 | */ | 2433 | */ |
@@ -2460,7 +2459,7 @@ int xtAppend(tid_t tid, /* transaction id */ | |||
2460 | (ulong) xoff, maxblocks, xlen, (ulong) xaddr); | 2459 | (ulong) xoff, maxblocks, xlen, (ulong) xaddr); |
2461 | 2460 | ||
2462 | /* | 2461 | /* |
2463 | * search for the entry location at which to insert: | 2462 | * search for the entry location at which to insert: |
2464 | * | 2463 | * |
2465 | * xtFastSearch() and xtSearch() both returns (leaf page | 2464 | * xtFastSearch() and xtSearch() both returns (leaf page |
2466 | * pinned, index at which to insert). | 2465 | * pinned, index at which to insert). |
@@ -2482,13 +2481,13 @@ int xtAppend(tid_t tid, /* transaction id */ | |||
2482 | xlen = min(xlen, (int)(next - xoff)); | 2481 | xlen = min(xlen, (int)(next - xoff)); |
2483 | //insert: | 2482 | //insert: |
2484 | /* | 2483 | /* |
2485 | * insert entry for new extent | 2484 | * insert entry for new extent |
2486 | */ | 2485 | */ |
2487 | xflag |= XAD_NEW; | 2486 | xflag |= XAD_NEW; |
2488 | 2487 | ||
2489 | /* | 2488 | /* |
2490 | * if the leaf page is full, split the page and | 2489 | * if the leaf page is full, split the page and |
2491 | * propagate up the router entry for the new page from split | 2490 | * propagate up the router entry for the new page from split |
2492 | * | 2491 | * |
2493 | * The xtSplitUp() will insert the entry and unpin the leaf page. | 2492 | * The xtSplitUp() will insert the entry and unpin the leaf page. |
2494 | */ | 2493 | */ |
@@ -2545,7 +2544,7 @@ int xtAppend(tid_t tid, /* transaction id */ | |||
2545 | return 0; | 2544 | return 0; |
2546 | 2545 | ||
2547 | /* | 2546 | /* |
2548 | * insert the new entry into the leaf page | 2547 | * insert the new entry into the leaf page |
2549 | */ | 2548 | */ |
2550 | insertLeaf: | 2549 | insertLeaf: |
2551 | /* | 2550 | /* |
@@ -2589,17 +2588,17 @@ int xtAppend(tid_t tid, /* transaction id */ | |||
2589 | 2588 | ||
2590 | /* - TBD for defragmentaion/reorganization - | 2589 | /* - TBD for defragmentaion/reorganization - |
2591 | * | 2590 | * |
2592 | * xtDelete() | 2591 | * xtDelete() |
2593 | * | 2592 | * |
2594 | * function: | 2593 | * function: |
2595 | * delete the entry with the specified key. | 2594 | * delete the entry with the specified key. |
2596 | * | 2595 | * |
2597 | * N.B.: whole extent of the entry is assumed to be deleted. | 2596 | * N.B.: whole extent of the entry is assumed to be deleted. |
2598 | * | 2597 | * |
2599 | * parameter: | 2598 | * parameter: |
2600 | * | 2599 | * |
2601 | * return: | 2600 | * return: |
2602 | * ENOENT: if the entry is not found. | 2601 | * ENOENT: if the entry is not found. |
2603 | * | 2602 | * |
2604 | * exception: | 2603 | * exception: |
2605 | */ | 2604 | */ |
@@ -2665,10 +2664,10 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag) | |||
2665 | 2664 | ||
2666 | /* - TBD for defragmentaion/reorganization - | 2665 | /* - TBD for defragmentaion/reorganization - |
2667 | * | 2666 | * |
2668 | * xtDeleteUp() | 2667 | * xtDeleteUp() |
2669 | * | 2668 | * |
2670 | * function: | 2669 | * function: |
2671 | * free empty pages as propagating deletion up the tree | 2670 | * free empty pages as propagating deletion up the tree |
2672 | * | 2671 | * |
2673 | * parameter: | 2672 | * parameter: |
2674 | * | 2673 | * |
@@ -2815,15 +2814,15 @@ xtDeleteUp(tid_t tid, struct inode *ip, | |||
2815 | 2814 | ||
2816 | 2815 | ||
2817 | /* | 2816 | /* |
2818 | * NAME: xtRelocate() | 2817 | * NAME: xtRelocate() |
2819 | * | 2818 | * |
2820 | * FUNCTION: relocate xtpage or data extent of regular file; | 2819 | * FUNCTION: relocate xtpage or data extent of regular file; |
2821 | * This function is mainly used by defragfs utility. | 2820 | * This function is mainly used by defragfs utility. |
2822 | * | 2821 | * |
2823 | * NOTE: This routine does not have the logic to handle | 2822 | * NOTE: This routine does not have the logic to handle |
2824 | * uncommitted allocated extent. The caller should call | 2823 | * uncommitted allocated extent. The caller should call |
2825 | * txCommit() to commit all the allocation before call | 2824 | * txCommit() to commit all the allocation before call |
2826 | * this routine. | 2825 | * this routine. |
2827 | */ | 2826 | */ |
2828 | int | 2827 | int |
2829 | xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | 2828 | xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ |
@@ -2865,8 +2864,8 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
2865 | xtype, (ulong) xoff, xlen, (ulong) oxaddr, (ulong) nxaddr); | 2864 | xtype, (ulong) xoff, xlen, (ulong) oxaddr, (ulong) nxaddr); |
2866 | 2865 | ||
2867 | /* | 2866 | /* |
2868 | * 1. get and validate the parent xtpage/xad entry | 2867 | * 1. get and validate the parent xtpage/xad entry |
2869 | * covering the source extent to be relocated; | 2868 | * covering the source extent to be relocated; |
2870 | */ | 2869 | */ |
2871 | if (xtype == DATAEXT) { | 2870 | if (xtype == DATAEXT) { |
2872 | /* search in leaf entry */ | 2871 | /* search in leaf entry */ |
@@ -2910,7 +2909,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
2910 | jfs_info("xtRelocate: parent xad entry validated."); | 2909 | jfs_info("xtRelocate: parent xad entry validated."); |
2911 | 2910 | ||
2912 | /* | 2911 | /* |
2913 | * 2. relocate the extent | 2912 | * 2. relocate the extent |
2914 | */ | 2913 | */ |
2915 | if (xtype == DATAEXT) { | 2914 | if (xtype == DATAEXT) { |
2916 | /* if the extent is allocated-but-not-recorded | 2915 | /* if the extent is allocated-but-not-recorded |
@@ -2923,7 +2922,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
2923 | XT_PUTPAGE(pmp); | 2922 | XT_PUTPAGE(pmp); |
2924 | 2923 | ||
2925 | /* | 2924 | /* |
2926 | * cmRelocate() | 2925 | * cmRelocate() |
2927 | * | 2926 | * |
2928 | * copy target data pages to be relocated; | 2927 | * copy target data pages to be relocated; |
2929 | * | 2928 | * |
@@ -2945,8 +2944,8 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
2945 | pno = offset >> CM_L2BSIZE; | 2944 | pno = offset >> CM_L2BSIZE; |
2946 | npages = (nbytes + (CM_BSIZE - 1)) >> CM_L2BSIZE; | 2945 | npages = (nbytes + (CM_BSIZE - 1)) >> CM_L2BSIZE; |
2947 | /* | 2946 | /* |
2948 | npages = ((offset + nbytes - 1) >> CM_L2BSIZE) - | 2947 | npages = ((offset + nbytes - 1) >> CM_L2BSIZE) - |
2949 | (offset >> CM_L2BSIZE) + 1; | 2948 | (offset >> CM_L2BSIZE) + 1; |
2950 | */ | 2949 | */ |
2951 | sxaddr = oxaddr; | 2950 | sxaddr = oxaddr; |
2952 | dxaddr = nxaddr; | 2951 | dxaddr = nxaddr; |
@@ -2981,7 +2980,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
2981 | 2980 | ||
2982 | XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index); | 2981 | XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index); |
2983 | jfs_info("xtRelocate: target data extent relocated."); | 2982 | jfs_info("xtRelocate: target data extent relocated."); |
2984 | } else { /* (xtype == XTPAGE) */ | 2983 | } else { /* (xtype == XTPAGE) */ |
2985 | 2984 | ||
2986 | /* | 2985 | /* |
2987 | * read in the target xtpage from the source extent; | 2986 | * read in the target xtpage from the source extent; |
@@ -3026,16 +3025,14 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3026 | */ | 3025 | */ |
3027 | if (lmp) { | 3026 | if (lmp) { |
3028 | BT_MARK_DIRTY(lmp, ip); | 3027 | BT_MARK_DIRTY(lmp, ip); |
3029 | tlck = | 3028 | tlck = txLock(tid, ip, lmp, tlckXTREE | tlckRELINK); |
3030 | txLock(tid, ip, lmp, tlckXTREE | tlckRELINK); | ||
3031 | lp->header.next = cpu_to_le64(nxaddr); | 3029 | lp->header.next = cpu_to_le64(nxaddr); |
3032 | XT_PUTPAGE(lmp); | 3030 | XT_PUTPAGE(lmp); |
3033 | } | 3031 | } |
3034 | 3032 | ||
3035 | if (rmp) { | 3033 | if (rmp) { |
3036 | BT_MARK_DIRTY(rmp, ip); | 3034 | BT_MARK_DIRTY(rmp, ip); |
3037 | tlck = | 3035 | tlck = txLock(tid, ip, rmp, tlckXTREE | tlckRELINK); |
3038 | txLock(tid, ip, rmp, tlckXTREE | tlckRELINK); | ||
3039 | rp->header.prev = cpu_to_le64(nxaddr); | 3036 | rp->header.prev = cpu_to_le64(nxaddr); |
3040 | XT_PUTPAGE(rmp); | 3037 | XT_PUTPAGE(rmp); |
3041 | } | 3038 | } |
@@ -3062,7 +3059,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3062 | * scan may be skipped by commit() and logredo(); | 3059 | * scan may be skipped by commit() and logredo(); |
3063 | */ | 3060 | */ |
3064 | BT_MARK_DIRTY(mp, ip); | 3061 | BT_MARK_DIRTY(mp, ip); |
3065 | /* tlckNEW init xtlck->lwm.offset = XTENTRYSTART; */ | 3062 | /* tlckNEW init xtlck->lwm.offset = XTENTRYSTART; */ |
3066 | tlck = txLock(tid, ip, mp, tlckXTREE | tlckNEW); | 3063 | tlck = txLock(tid, ip, mp, tlckXTREE | tlckNEW); |
3067 | xtlck = (struct xtlock *) & tlck->lock; | 3064 | xtlck = (struct xtlock *) & tlck->lock; |
3068 | 3065 | ||
@@ -3084,7 +3081,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3084 | } | 3081 | } |
3085 | 3082 | ||
3086 | /* | 3083 | /* |
3087 | * 3. acquire maplock for the source extent to be freed; | 3084 | * 3. acquire maplock for the source extent to be freed; |
3088 | * | 3085 | * |
3089 | * acquire a maplock saving the src relocated extent address; | 3086 | * acquire a maplock saving the src relocated extent address; |
3090 | * to free of the extent at commit time; | 3087 | * to free of the extent at commit time; |
@@ -3105,7 +3102,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3105 | * is no buffer associated with this lock since the buffer | 3102 | * is no buffer associated with this lock since the buffer |
3106 | * has been redirected to the target location. | 3103 | * has been redirected to the target location. |
3107 | */ | 3104 | */ |
3108 | else /* (xtype == XTPAGE) */ | 3105 | else /* (xtype == XTPAGE) */ |
3109 | tlck = txMaplock(tid, ip, tlckMAP | tlckRELOCATE); | 3106 | tlck = txMaplock(tid, ip, tlckMAP | tlckRELOCATE); |
3110 | 3107 | ||
3111 | pxdlock = (struct pxd_lock *) & tlck->lock; | 3108 | pxdlock = (struct pxd_lock *) & tlck->lock; |
@@ -3115,7 +3112,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3115 | pxdlock->index = 1; | 3112 | pxdlock->index = 1; |
3116 | 3113 | ||
3117 | /* | 3114 | /* |
3118 | * 4. update the parent xad entry for relocation; | 3115 | * 4. update the parent xad entry for relocation; |
3119 | * | 3116 | * |
3120 | * acquire tlck for the parent entry with XAD_NEW as entry | 3117 | * acquire tlck for the parent entry with XAD_NEW as entry |
3121 | * update which will write LOG_REDOPAGE and update bmap for | 3118 | * update which will write LOG_REDOPAGE and update bmap for |
@@ -3143,22 +3140,22 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ | |||
3143 | 3140 | ||
3144 | 3141 | ||
3145 | /* | 3142 | /* |
3146 | * xtSearchNode() | 3143 | * xtSearchNode() |
3147 | * | 3144 | * |
3148 | * function: search for the internal xad entry covering specified extent. | 3145 | * function: search for the internal xad entry covering specified extent. |
3149 | * This function is mainly used by defragfs utility. | 3146 | * This function is mainly used by defragfs utility. |
3150 | * | 3147 | * |
3151 | * parameters: | 3148 | * parameters: |
3152 | * ip - file object; | 3149 | * ip - file object; |
3153 | * xad - extent to find; | 3150 | * xad - extent to find; |
3154 | * cmpp - comparison result: | 3151 | * cmpp - comparison result: |
3155 | * btstack - traverse stack; | 3152 | * btstack - traverse stack; |
3156 | * flag - search process flag; | 3153 | * flag - search process flag; |
3157 | * | 3154 | * |
3158 | * returns: | 3155 | * returns: |
3159 | * btstack contains (bn, index) of search path traversed to the entry. | 3156 | * btstack contains (bn, index) of search path traversed to the entry. |
3160 | * *cmpp is set to result of comparison with the entry returned. | 3157 | * *cmpp is set to result of comparison with the entry returned. |
3161 | * the page containing the entry is pinned at exit. | 3158 | * the page containing the entry is pinned at exit. |
3162 | */ | 3159 | */ |
3163 | static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ | 3160 | static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ |
3164 | int *cmpp, struct btstack * btstack, int flag) | 3161 | int *cmpp, struct btstack * btstack, int flag) |
@@ -3181,7 +3178,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ | |||
3181 | xaddr = addressXAD(xad); | 3178 | xaddr = addressXAD(xad); |
3182 | 3179 | ||
3183 | /* | 3180 | /* |
3184 | * search down tree from root: | 3181 | * search down tree from root: |
3185 | * | 3182 | * |
3186 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of | 3183 | * between two consecutive entries of <Ki, Pi> and <Kj, Pj> of |
3187 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. | 3184 | * internal page, child page Pi contains entry with k, Ki <= K < Kj. |
@@ -3217,7 +3214,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ | |||
3217 | XT_CMP(cmp, xoff, &p->xad[index], t64); | 3214 | XT_CMP(cmp, xoff, &p->xad[index], t64); |
3218 | if (cmp == 0) { | 3215 | if (cmp == 0) { |
3219 | /* | 3216 | /* |
3220 | * search hit | 3217 | * search hit |
3221 | * | 3218 | * |
3222 | * verify for exact match; | 3219 | * verify for exact match; |
3223 | */ | 3220 | */ |
@@ -3245,7 +3242,7 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ | |||
3245 | } | 3242 | } |
3246 | 3243 | ||
3247 | /* | 3244 | /* |
3248 | * search miss - non-leaf page: | 3245 | * search miss - non-leaf page: |
3249 | * | 3246 | * |
3250 | * base is the smallest index with key (Kj) greater than | 3247 | * base is the smallest index with key (Kj) greater than |
3251 | * search key (K) and may be zero or maxentry index. | 3248 | * search key (K) and may be zero or maxentry index. |
@@ -3268,15 +3265,15 @@ static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */ | |||
3268 | 3265 | ||
3269 | 3266 | ||
3270 | /* | 3267 | /* |
3271 | * xtRelink() | 3268 | * xtRelink() |
3272 | * | 3269 | * |
3273 | * function: | 3270 | * function: |
3274 | * link around a freed page. | 3271 | * link around a freed page. |
3275 | * | 3272 | * |
3276 | * Parameter: | 3273 | * Parameter: |
3277 | * int tid, | 3274 | * int tid, |
3278 | * struct inode *ip, | 3275 | * struct inode *ip, |
3279 | * xtpage_t *p) | 3276 | * xtpage_t *p) |
3280 | * | 3277 | * |
3281 | * returns: | 3278 | * returns: |
3282 | */ | 3279 | */ |
@@ -3338,7 +3335,7 @@ static int xtRelink(tid_t tid, struct inode *ip, xtpage_t * p) | |||
3338 | 3335 | ||
3339 | 3336 | ||
3340 | /* | 3337 | /* |
3341 | * xtInitRoot() | 3338 | * xtInitRoot() |
3342 | * | 3339 | * |
3343 | * initialize file root (inline in inode) | 3340 | * initialize file root (inline in inode) |
3344 | */ | 3341 | */ |
@@ -3385,42 +3382,42 @@ void xtInitRoot(tid_t tid, struct inode *ip) | |||
3385 | #define MAX_TRUNCATE_LEAVES 50 | 3382 | #define MAX_TRUNCATE_LEAVES 50 |
3386 | 3383 | ||
3387 | /* | 3384 | /* |
3388 | * xtTruncate() | 3385 | * xtTruncate() |
3389 | * | 3386 | * |
3390 | * function: | 3387 | * function: |
3391 | * traverse for truncation logging backward bottom up; | 3388 | * traverse for truncation logging backward bottom up; |
3392 | * terminate at the last extent entry at the current subtree | 3389 | * terminate at the last extent entry at the current subtree |
3393 | * root page covering new down size. | 3390 | * root page covering new down size. |
3394 | * truncation may occur within the last extent entry. | 3391 | * truncation may occur within the last extent entry. |
3395 | * | 3392 | * |
3396 | * parameter: | 3393 | * parameter: |
3397 | * int tid, | 3394 | * int tid, |
3398 | * struct inode *ip, | 3395 | * struct inode *ip, |
3399 | * s64 newsize, | 3396 | * s64 newsize, |
3400 | * int type) {PWMAP, PMAP, WMAP; DELETE, TRUNCATE} | 3397 | * int type) {PWMAP, PMAP, WMAP; DELETE, TRUNCATE} |
3401 | * | 3398 | * |
3402 | * return: | 3399 | * return: |
3403 | * | 3400 | * |
3404 | * note: | 3401 | * note: |
3405 | * PWMAP: | 3402 | * PWMAP: |
3406 | * 1. truncate (non-COMMIT_NOLINK file) | 3403 | * 1. truncate (non-COMMIT_NOLINK file) |
3407 | * by jfs_truncate() or jfs_open(O_TRUNC): | 3404 | * by jfs_truncate() or jfs_open(O_TRUNC): |
3408 | * xtree is updated; | 3405 | * xtree is updated; |
3409 | * 2. truncate index table of directory when last entry removed | 3406 | * 2. truncate index table of directory when last entry removed |
3410 | * map update via tlock at commit time; | 3407 | * map update via tlock at commit time; |
3411 | * PMAP: | 3408 | * PMAP: |
3412 | * Call xtTruncate_pmap instead | 3409 | * Call xtTruncate_pmap instead |
3413 | * WMAP: | 3410 | * WMAP: |
3414 | * 1. remove (free zero link count) on last reference release | 3411 | * 1. remove (free zero link count) on last reference release |
3415 | * (pmap has been freed at commit zero link count); | 3412 | * (pmap has been freed at commit zero link count); |
3416 | * 2. truncate (COMMIT_NOLINK file, i.e., tmp file): | 3413 | * 2. truncate (COMMIT_NOLINK file, i.e., tmp file): |
3417 | * xtree is updated; | 3414 | * xtree is updated; |
3418 | * map update directly at truncation time; | 3415 | * map update directly at truncation time; |
3419 | * | 3416 | * |
3420 | * if (DELETE) | 3417 | * if (DELETE) |
3421 | * no LOG_NOREDOPAGE is required (NOREDOFILE is sufficient); | 3418 | * no LOG_NOREDOPAGE is required (NOREDOFILE is sufficient); |
3422 | * else if (TRUNCATE) | 3419 | * else if (TRUNCATE) |
3423 | * must write LOG_NOREDOPAGE for deleted index page; | 3420 | * must write LOG_NOREDOPAGE for deleted index page; |
3424 | * | 3421 | * |
3425 | * pages may already have been tlocked by anonymous transactions | 3422 | * pages may already have been tlocked by anonymous transactions |
3426 | * during file growth (i.e., write) before truncation; | 3423 | * during file growth (i.e., write) before truncation; |
@@ -3493,7 +3490,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3493 | * retained in the new sized file. | 3490 | * retained in the new sized file. |
3494 | * if type is PMAP, the data and index pages are NOT | 3491 | * if type is PMAP, the data and index pages are NOT |
3495 | * freed, and the data and index blocks are NOT freed | 3492 | * freed, and the data and index blocks are NOT freed |
3496 | * from working map. | 3493 | * from working map. |
3497 | * (this will allow continued access of data/index of | 3494 | * (this will allow continued access of data/index of |
3498 | * temporary file (zerolink count file truncated to zero-length)). | 3495 | * temporary file (zerolink count file truncated to zero-length)). |
3499 | */ | 3496 | */ |
@@ -3542,7 +3539,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3542 | goto getChild; | 3539 | goto getChild; |
3543 | 3540 | ||
3544 | /* | 3541 | /* |
3545 | * leaf page | 3542 | * leaf page |
3546 | */ | 3543 | */ |
3547 | freed = 0; | 3544 | freed = 0; |
3548 | 3545 | ||
@@ -3916,7 +3913,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3916 | } | 3913 | } |
3917 | 3914 | ||
3918 | /* | 3915 | /* |
3919 | * internal page: go down to child page of current entry | 3916 | * internal page: go down to child page of current entry |
3920 | */ | 3917 | */ |
3921 | getChild: | 3918 | getChild: |
3922 | /* save current parent entry for the child page */ | 3919 | /* save current parent entry for the child page */ |
@@ -3965,7 +3962,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3965 | 3962 | ||
3966 | 3963 | ||
3967 | /* | 3964 | /* |
3968 | * xtTruncate_pmap() | 3965 | * xtTruncate_pmap() |
3969 | * | 3966 | * |
3970 | * function: | 3967 | * function: |
3971 | * Perform truncate to zero lenghth for deleted file, leaving the | 3968 | * Perform truncate to zero lenghth for deleted file, leaving the |
@@ -3974,9 +3971,9 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3974 | * is committed to disk. | 3971 | * is committed to disk. |
3975 | * | 3972 | * |
3976 | * parameter: | 3973 | * parameter: |
3977 | * tid_t tid, | 3974 | * tid_t tid, |
3978 | * struct inode *ip, | 3975 | * struct inode *ip, |
3979 | * s64 committed_size) | 3976 | * s64 committed_size) |
3980 | * | 3977 | * |
3981 | * return: new committed size | 3978 | * return: new committed size |
3982 | * | 3979 | * |
@@ -4050,7 +4047,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
4050 | } | 4047 | } |
4051 | 4048 | ||
4052 | /* | 4049 | /* |
4053 | * leaf page | 4050 | * leaf page |
4054 | */ | 4051 | */ |
4055 | 4052 | ||
4056 | if (++locked_leaves > MAX_TRUNCATE_LEAVES) { | 4053 | if (++locked_leaves > MAX_TRUNCATE_LEAVES) { |
@@ -4062,7 +4059,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
4062 | xoff = offsetXAD(xad); | 4059 | xoff = offsetXAD(xad); |
4063 | xlen = lengthXAD(xad); | 4060 | xlen = lengthXAD(xad); |
4064 | XT_PUTPAGE(mp); | 4061 | XT_PUTPAGE(mp); |
4065 | return (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize; | 4062 | return (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize; |
4066 | } | 4063 | } |
4067 | tlck = txLock(tid, ip, mp, tlckXTREE); | 4064 | tlck = txLock(tid, ip, mp, tlckXTREE); |
4068 | tlck->type = tlckXTREE | tlckFREE; | 4065 | tlck->type = tlckXTREE | tlckFREE; |
@@ -4099,8 +4096,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
4099 | */ | 4096 | */ |
4100 | tlck = txLock(tid, ip, mp, tlckXTREE); | 4097 | tlck = txLock(tid, ip, mp, tlckXTREE); |
4101 | xtlck = (struct xtlock *) & tlck->lock; | 4098 | xtlck = (struct xtlock *) & tlck->lock; |
4102 | xtlck->hwm.offset = | 4099 | xtlck->hwm.offset = le16_to_cpu(p->header.nextindex) - 1; |
4103 | le16_to_cpu(p->header.nextindex) - 1; | ||
4104 | tlck->type = tlckXTREE | tlckFREE; | 4100 | tlck->type = tlckXTREE | tlckFREE; |
4105 | 4101 | ||
4106 | XT_PUTPAGE(mp); | 4102 | XT_PUTPAGE(mp); |
@@ -4118,7 +4114,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
4118 | else | 4114 | else |
4119 | index--; | 4115 | index--; |
4120 | /* | 4116 | /* |
4121 | * internal page: go down to child page of current entry | 4117 | * internal page: go down to child page of current entry |
4122 | */ | 4118 | */ |
4123 | getChild: | 4119 | getChild: |
4124 | /* save current parent entry for the child page */ | 4120 | /* save current parent entry for the child page */ |
diff --git a/fs/jfs/jfs_xtree.h b/fs/jfs/jfs_xtree.h index 164f6f2b1019..70815c8a3d6a 100644 --- a/fs/jfs/jfs_xtree.h +++ b/fs/jfs/jfs_xtree.h | |||
@@ -19,14 +19,14 @@ | |||
19 | #define _H_JFS_XTREE | 19 | #define _H_JFS_XTREE |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * jfs_xtree.h: extent allocation descriptor B+-tree manager | 22 | * jfs_xtree.h: extent allocation descriptor B+-tree manager |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "jfs_btree.h" | 25 | #include "jfs_btree.h" |
26 | 26 | ||
27 | 27 | ||
28 | /* | 28 | /* |
29 | * extent allocation descriptor (xad) | 29 | * extent allocation descriptor (xad) |
30 | */ | 30 | */ |
31 | typedef struct xad { | 31 | typedef struct xad { |
32 | unsigned flag:8; /* 1: flag */ | 32 | unsigned flag:8; /* 1: flag */ |
@@ -38,30 +38,30 @@ typedef struct xad { | |||
38 | __le32 addr2; /* 4: address in unit of fsblksize */ | 38 | __le32 addr2; /* 4: address in unit of fsblksize */ |
39 | } xad_t; /* (16) */ | 39 | } xad_t; /* (16) */ |
40 | 40 | ||
41 | #define MAXXLEN ((1 << 24) - 1) | 41 | #define MAXXLEN ((1 << 24) - 1) |
42 | 42 | ||
43 | #define XTSLOTSIZE 16 | 43 | #define XTSLOTSIZE 16 |
44 | #define L2XTSLOTSIZE 4 | 44 | #define L2XTSLOTSIZE 4 |
45 | 45 | ||
46 | /* xad_t field construction */ | 46 | /* xad_t field construction */ |
47 | #define XADoffset(xad, offset64)\ | 47 | #define XADoffset(xad, offset64)\ |
48 | {\ | 48 | {\ |
49 | (xad)->off1 = ((u64)offset64) >> 32;\ | 49 | (xad)->off1 = ((u64)offset64) >> 32;\ |
50 | (xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\ | 50 | (xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\ |
51 | } | 51 | } |
52 | #define XADaddress(xad, address64)\ | 52 | #define XADaddress(xad, address64)\ |
53 | {\ | 53 | {\ |
54 | (xad)->addr1 = ((u64)address64) >> 32;\ | 54 | (xad)->addr1 = ((u64)address64) >> 32;\ |
55 | (xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\ | 55 | (xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\ |
56 | } | 56 | } |
57 | #define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32) | 57 | #define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32) |
58 | 58 | ||
59 | /* xad_t field extraction */ | 59 | /* xad_t field extraction */ |
60 | #define offsetXAD(xad)\ | 60 | #define offsetXAD(xad)\ |
61 | ( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2)) | 61 | ( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2)) |
62 | #define addressXAD(xad)\ | 62 | #define addressXAD(xad)\ |
63 | ( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2)) | 63 | ( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2)) |
64 | #define lengthXAD(xad) __le24_to_cpu((xad)->len) | 64 | #define lengthXAD(xad) __le24_to_cpu((xad)->len) |
65 | 65 | ||
66 | /* xad list */ | 66 | /* xad list */ |
67 | struct xadlist { | 67 | struct xadlist { |
@@ -71,22 +71,22 @@ struct xadlist { | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | /* xad_t flags */ | 73 | /* xad_t flags */ |
74 | #define XAD_NEW 0x01 /* new */ | 74 | #define XAD_NEW 0x01 /* new */ |
75 | #define XAD_EXTENDED 0x02 /* extended */ | 75 | #define XAD_EXTENDED 0x02 /* extended */ |
76 | #define XAD_COMPRESSED 0x04 /* compressed with recorded length */ | 76 | #define XAD_COMPRESSED 0x04 /* compressed with recorded length */ |
77 | #define XAD_NOTRECORDED 0x08 /* allocated but not recorded */ | 77 | #define XAD_NOTRECORDED 0x08 /* allocated but not recorded */ |
78 | #define XAD_COW 0x10 /* copy-on-write */ | 78 | #define XAD_COW 0x10 /* copy-on-write */ |
79 | 79 | ||
80 | 80 | ||
81 | /* possible values for maxentry */ | 81 | /* possible values for maxentry */ |
82 | #define XTROOTINITSLOT_DIR 6 | 82 | #define XTROOTINITSLOT_DIR 6 |
83 | #define XTROOTINITSLOT 10 | 83 | #define XTROOTINITSLOT 10 |
84 | #define XTROOTMAXSLOT 18 | 84 | #define XTROOTMAXSLOT 18 |
85 | #define XTPAGEMAXSLOT 256 | 85 | #define XTPAGEMAXSLOT 256 |
86 | #define XTENTRYSTART 2 | 86 | #define XTENTRYSTART 2 |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * xtree page: | 89 | * xtree page: |
90 | */ | 90 | */ |
91 | typedef union { | 91 | typedef union { |
92 | struct xtheader { | 92 | struct xtheader { |
@@ -106,7 +106,7 @@ typedef union { | |||
106 | } xtpage_t; | 106 | } xtpage_t; |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * external declaration | 109 | * external declaration |
110 | */ | 110 | */ |
111 | extern int xtLookup(struct inode *ip, s64 lstart, s64 llen, | 111 | extern int xtLookup(struct inode *ip, s64 lstart, s64 llen, |
112 | int *pflag, s64 * paddr, int *plen, int flag); | 112 | int *pflag, s64 * paddr, int *plen, int flag); |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 41c204771262..25161c4121e4 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -328,7 +328,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
328 | * dentry - child directory dentry | 328 | * dentry - child directory dentry |
329 | * | 329 | * |
330 | * RETURN: -EINVAL - if name is . or .. | 330 | * RETURN: -EINVAL - if name is . or .. |
331 | * -EINVAL - if . or .. exist but are invalid. | 331 | * -EINVAL - if . or .. exist but are invalid. |
332 | * errors from subroutines | 332 | * errors from subroutines |
333 | * | 333 | * |
334 | * note: | 334 | * note: |
@@ -517,7 +517,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) | |||
517 | inode_dec_link_count(ip); | 517 | inode_dec_link_count(ip); |
518 | 518 | ||
519 | /* | 519 | /* |
520 | * commit zero link count object | 520 | * commit zero link count object |
521 | */ | 521 | */ |
522 | if (ip->i_nlink == 0) { | 522 | if (ip->i_nlink == 0) { |
523 | assert(!test_cflag(COMMIT_Nolink, ip)); | 523 | assert(!test_cflag(COMMIT_Nolink, ip)); |
@@ -596,7 +596,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) | |||
596 | /* | 596 | /* |
597 | * NAME: commitZeroLink() | 597 | * NAME: commitZeroLink() |
598 | * | 598 | * |
599 | * FUNCTION: for non-directory, called by jfs_remove(), | 599 | * FUNCTION: for non-directory, called by jfs_remove(), |
600 | * truncate a regular file, directory or symbolic | 600 | * truncate a regular file, directory or symbolic |
601 | * link to zero length. return 0 if type is not | 601 | * link to zero length. return 0 if type is not |
602 | * one of these. | 602 | * one of these. |
@@ -676,7 +676,7 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip) | |||
676 | /* | 676 | /* |
677 | * NAME: jfs_free_zero_link() | 677 | * NAME: jfs_free_zero_link() |
678 | * | 678 | * |
679 | * FUNCTION: for non-directory, called by iClose(), | 679 | * FUNCTION: for non-directory, called by iClose(), |
680 | * free resources of a file from cache and WORKING map | 680 | * free resources of a file from cache and WORKING map |
681 | * for a file previously committed with zero link count | 681 | * for a file previously committed with zero link count |
682 | * while associated with a pager object, | 682 | * while associated with a pager object, |
@@ -855,12 +855,12 @@ static int jfs_link(struct dentry *old_dentry, | |||
855 | * NAME: jfs_symlink(dip, dentry, name) | 855 | * NAME: jfs_symlink(dip, dentry, name) |
856 | * | 856 | * |
857 | * FUNCTION: creates a symbolic link to <symlink> by name <name> | 857 | * FUNCTION: creates a symbolic link to <symlink> by name <name> |
858 | * in directory <dip> | 858 | * in directory <dip> |
859 | * | 859 | * |
860 | * PARAMETER: dip - parent directory vnode | 860 | * PARAMETER: dip - parent directory vnode |
861 | * dentry - dentry of symbolic link | 861 | * dentry - dentry of symbolic link |
862 | * name - the path name of the existing object | 862 | * name - the path name of the existing object |
863 | * that will be the source of the link | 863 | * that will be the source of the link |
864 | * | 864 | * |
865 | * RETURN: errors from subroutines | 865 | * RETURN: errors from subroutines |
866 | * | 866 | * |
@@ -1052,9 +1052,9 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
1052 | 1052 | ||
1053 | 1053 | ||
1054 | /* | 1054 | /* |
1055 | * NAME: jfs_rename | 1055 | * NAME: jfs_rename |
1056 | * | 1056 | * |
1057 | * FUNCTION: rename a file or directory | 1057 | * FUNCTION: rename a file or directory |
1058 | */ | 1058 | */ |
1059 | static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 1059 | static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1060 | struct inode *new_dir, struct dentry *new_dentry) | 1060 | struct inode *new_dir, struct dentry *new_dentry) |
@@ -1331,9 +1331,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1331 | 1331 | ||
1332 | 1332 | ||
1333 | /* | 1333 | /* |
1334 | * NAME: jfs_mknod | 1334 | * NAME: jfs_mknod |
1335 | * | 1335 | * |
1336 | * FUNCTION: Create a special file (device) | 1336 | * FUNCTION: Create a special file (device) |
1337 | */ | 1337 | */ |
1338 | static int jfs_mknod(struct inode *dir, struct dentry *dentry, | 1338 | static int jfs_mknod(struct inode *dir, struct dentry *dentry, |
1339 | int mode, dev_t rdev) | 1339 | int mode, dev_t rdev) |
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c index 79d625f3f733..71984ee95346 100644 --- a/fs/jfs/resize.c +++ b/fs/jfs/resize.c | |||
@@ -29,17 +29,17 @@ | |||
29 | #include "jfs_txnmgr.h" | 29 | #include "jfs_txnmgr.h" |
30 | #include "jfs_debug.h" | 30 | #include "jfs_debug.h" |
31 | 31 | ||
32 | #define BITSPERPAGE (PSIZE << 3) | 32 | #define BITSPERPAGE (PSIZE << 3) |
33 | #define L2MEGABYTE 20 | 33 | #define L2MEGABYTE 20 |
34 | #define MEGABYTE (1 << L2MEGABYTE) | 34 | #define MEGABYTE (1 << L2MEGABYTE) |
35 | #define MEGABYTE32 (MEGABYTE << 5) | 35 | #define MEGABYTE32 (MEGABYTE << 5) |
36 | 36 | ||
37 | /* convert block number to bmap file page number */ | 37 | /* convert block number to bmap file page number */ |
38 | #define BLKTODMAPN(b)\ | 38 | #define BLKTODMAPN(b)\ |
39 | (((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) | 39 | (((b) >> 13) + ((b) >> 23) + ((b) >> 33) + 3 + 1) |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * jfs_extendfs() | 42 | * jfs_extendfs() |
43 | * | 43 | * |
44 | * function: extend file system; | 44 | * function: extend file system; |
45 | * | 45 | * |
@@ -48,9 +48,9 @@ | |||
48 | * workspace space | 48 | * workspace space |
49 | * | 49 | * |
50 | * input: | 50 | * input: |
51 | * new LVSize: in LV blocks (required) | 51 | * new LVSize: in LV blocks (required) |
52 | * new LogSize: in LV blocks (optional) | 52 | * new LogSize: in LV blocks (optional) |
53 | * new FSSize: in LV blocks (optional) | 53 | * new FSSize: in LV blocks (optional) |
54 | * | 54 | * |
55 | * new configuration: | 55 | * new configuration: |
56 | * 1. set new LogSize as specified or default from new LVSize; | 56 | * 1. set new LogSize as specified or default from new LVSize; |
@@ -125,8 +125,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
125 | } | 125 | } |
126 | 126 | ||
127 | /* | 127 | /* |
128 | * reconfigure LV spaces | 128 | * reconfigure LV spaces |
129 | * --------------------- | 129 | * --------------------- |
130 | * | 130 | * |
131 | * validate new size, or, if not specified, determine new size | 131 | * validate new size, or, if not specified, determine new size |
132 | */ | 132 | */ |
@@ -198,7 +198,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
198 | log_formatted = 1; | 198 | log_formatted = 1; |
199 | } | 199 | } |
200 | /* | 200 | /* |
201 | * quiesce file system | 201 | * quiesce file system |
202 | * | 202 | * |
203 | * (prepare to move the inline log and to prevent map update) | 203 | * (prepare to move the inline log and to prevent map update) |
204 | * | 204 | * |
@@ -270,8 +270,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | /* | 272 | /* |
273 | * extend block allocation map | 273 | * extend block allocation map |
274 | * --------------------------- | 274 | * --------------------------- |
275 | * | 275 | * |
276 | * extendfs() for new extension, retry after crash recovery; | 276 | * extendfs() for new extension, retry after crash recovery; |
277 | * | 277 | * |
@@ -283,7 +283,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
283 | * s_size: aggregate size in physical blocks; | 283 | * s_size: aggregate size in physical blocks; |
284 | */ | 284 | */ |
285 | /* | 285 | /* |
286 | * compute the new block allocation map configuration | 286 | * compute the new block allocation map configuration |
287 | * | 287 | * |
288 | * map dinode: | 288 | * map dinode: |
289 | * di_size: map file size in byte; | 289 | * di_size: map file size in byte; |
@@ -301,7 +301,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
301 | newNpages = BLKTODMAPN(t64) + 1; | 301 | newNpages = BLKTODMAPN(t64) + 1; |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * extend map from current map (WITHOUT growing mapfile) | 304 | * extend map from current map (WITHOUT growing mapfile) |
305 | * | 305 | * |
306 | * map new extension with unmapped part of the last partial | 306 | * map new extension with unmapped part of the last partial |
307 | * dmap page, if applicable, and extra page(s) allocated | 307 | * dmap page, if applicable, and extra page(s) allocated |
@@ -341,8 +341,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
341 | XSize -= nblocks; | 341 | XSize -= nblocks; |
342 | 342 | ||
343 | /* | 343 | /* |
344 | * grow map file to cover remaining extension | 344 | * grow map file to cover remaining extension |
345 | * and/or one extra dmap page for next extendfs(); | 345 | * and/or one extra dmap page for next extendfs(); |
346 | * | 346 | * |
347 | * allocate new map pages and its backing blocks, and | 347 | * allocate new map pages and its backing blocks, and |
348 | * update map file xtree | 348 | * update map file xtree |
@@ -422,8 +422,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
422 | dbFinalizeBmap(ipbmap); | 422 | dbFinalizeBmap(ipbmap); |
423 | 423 | ||
424 | /* | 424 | /* |
425 | * update inode allocation map | 425 | * update inode allocation map |
426 | * --------------------------- | 426 | * --------------------------- |
427 | * | 427 | * |
428 | * move iag lists from old to new iag; | 428 | * move iag lists from old to new iag; |
429 | * agstart field is not updated for logredo() to reconstruct | 429 | * agstart field is not updated for logredo() to reconstruct |
@@ -442,8 +442,8 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
442 | } | 442 | } |
443 | 443 | ||
444 | /* | 444 | /* |
445 | * finalize | 445 | * finalize |
446 | * -------- | 446 | * -------- |
447 | * | 447 | * |
448 | * extension is committed when on-disk super block is | 448 | * extension is committed when on-disk super block is |
449 | * updated with new descriptors: logredo will recover | 449 | * updated with new descriptors: logredo will recover |
@@ -480,7 +480,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
480 | diFreeSpecial(ipbmap2); | 480 | diFreeSpecial(ipbmap2); |
481 | 481 | ||
482 | /* | 482 | /* |
483 | * update superblock | 483 | * update superblock |
484 | */ | 484 | */ |
485 | if ((rc = readSuper(sb, &bh))) | 485 | if ((rc = readSuper(sb, &bh))) |
486 | goto error_out; | 486 | goto error_out; |
@@ -530,7 +530,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
530 | 530 | ||
531 | resume: | 531 | resume: |
532 | /* | 532 | /* |
533 | * resume file system transactions | 533 | * resume file system transactions |
534 | */ | 534 | */ |
535 | txResume(sb); | 535 | txResume(sb); |
536 | 536 | ||
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index b753ba216450..5c0f2de01316 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -63,9 +63,9 @@ | |||
63 | * | 63 | * |
64 | * On-disk: | 64 | * On-disk: |
65 | * | 65 | * |
66 | * FEALISTs are stored on disk using blocks allocated by dbAlloc() and | 66 | * FEALISTs are stored on disk using blocks allocated by dbAlloc() and |
67 | * written directly. An EA list may be in-lined in the inode if there is | 67 | * written directly. An EA list may be in-lined in the inode if there is |
68 | * sufficient room available. | 68 | * sufficient room available. |
69 | */ | 69 | */ |
70 | 70 | ||
71 | struct ea_buffer { | 71 | struct ea_buffer { |