summaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/objectid.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2014-04-23 10:00:36 -0400
committerJan Kara <jack@suse.cz>2014-05-06 16:52:19 -0400
commit098297b27d23ad9d0fc302e3417474d9342c6c14 (patch)
tree58f2054cd9933225ef1ae9c7febedc9160041af6 /fs/reiserfs/objectid.c
parent4cf5f7addf18ecae2ea49b11944976cbd26d5281 (diff)
reiserfs: cleanup, reformat comments to normal kernel style
This patch reformats comments in the reiserfs code to fit in 80 columns and to follow the style rules. There is no functional change but it helps make my eyes bleed less. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/objectid.c')
-rw-r--r--fs/reiserfs/objectid.c95
1 files changed, 55 insertions, 40 deletions
diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c
index f732d6a5251d..99f66f885785 100644
--- a/fs/reiserfs/objectid.c
+++ b/fs/reiserfs/objectid.c
@@ -7,7 +7,7 @@
7#include <linux/time.h> 7#include <linux/time.h>
8#include "reiserfs.h" 8#include "reiserfs.h"
9 9
10// find where objectid map starts 10/* find where objectid map starts */
11#define objectid_map(s,rs) (old_format_only (s) ? \ 11#define objectid_map(s,rs) (old_format_only (s) ? \
12 (__le32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\ 12 (__le32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\
13 (__le32 *)((rs) + 1)) 13 (__le32 *)((rs) + 1))
@@ -20,7 +20,7 @@ static void check_objectid_map(struct super_block *s, __le32 * map)
20 reiserfs_panic(s, "vs-15010", "map corrupted: %lx", 20 reiserfs_panic(s, "vs-15010", "map corrupted: %lx",
21 (long unsigned int)le32_to_cpu(map[0])); 21 (long unsigned int)le32_to_cpu(map[0]));
22 22
23 // FIXME: add something else here 23 /* FIXME: add something else here */
24} 24}
25 25
26#else 26#else
@@ -29,19 +29,21 @@ static void check_objectid_map(struct super_block *s, __le32 * map)
29} 29}
30#endif 30#endif
31 31
32/* When we allocate objectids we allocate the first unused objectid. 32/*
33 Each sequence of objectids in use (the odd sequences) is followed 33 * When we allocate objectids we allocate the first unused objectid.
34 by a sequence of objectids not in use (the even sequences). We 34 * Each sequence of objectids in use (the odd sequences) is followed
35 only need to record the last objectid in each of these sequences 35 * by a sequence of objectids not in use (the even sequences). We
36 (both the odd and even sequences) in order to fully define the 36 * only need to record the last objectid in each of these sequences
37 boundaries of the sequences. A consequence of allocating the first 37 * (both the odd and even sequences) in order to fully define the
38 objectid not in use is that under most conditions this scheme is 38 * boundaries of the sequences. A consequence of allocating the first
39 extremely compact. The exception is immediately after a sequence 39 * objectid not in use is that under most conditions this scheme is
40 of operations which deletes a large number of objects of 40 * extremely compact. The exception is immediately after a sequence
41 non-sequential objectids, and even then it will become compact 41 * of operations which deletes a large number of objects of
42 again as soon as more objects are created. Note that many 42 * non-sequential objectids, and even then it will become compact
43 interesting optimizations of layout could result from complicating 43 * again as soon as more objects are created. Note that many
44 objectid assignment, but we have deferred making them for now. */ 44 * interesting optimizations of layout could result from complicating
45 * objectid assignment, but we have deferred making them for now.
46 */
45 47
46/* get unique object identifier */ 48/* get unique object identifier */
47__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th) 49__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th)
@@ -64,19 +66,23 @@ __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th)
64 return 0; 66 return 0;
65 } 67 }
66 68
67 /* This incrementation allocates the first unused objectid. That 69 /*
68 is to say, the first entry on the objectid map is the first 70 * This incrementation allocates the first unused objectid. That
69 unused objectid, and by incrementing it we use it. See below 71 * is to say, the first entry on the objectid map is the first
70 where we check to see if we eliminated a sequence of unused 72 * unused objectid, and by incrementing it we use it. See below
71 objectids.... */ 73 * where we check to see if we eliminated a sequence of unused
74 * objectids....
75 */
72 map[1] = cpu_to_le32(unused_objectid + 1); 76 map[1] = cpu_to_le32(unused_objectid + 1);
73 77
74 /* Now we check to see if we eliminated the last remaining member of 78 /*
75 the first even sequence (and can eliminate the sequence by 79 * Now we check to see if we eliminated the last remaining member of
76 eliminating its last objectid from oids), and can collapse the 80 * the first even sequence (and can eliminate the sequence by
77 first two odd sequences into one sequence. If so, then the net 81 * eliminating its last objectid from oids), and can collapse the
78 result is to eliminate a pair of objectids from oids. We do this 82 * first two odd sequences into one sequence. If so, then the net
79 by shifting the entire map to the left. */ 83 * result is to eliminate a pair of objectids from oids. We do this
84 * by shifting the entire map to the left.
85 */
80 if (sb_oid_cursize(rs) > 2 && map[1] == map[2]) { 86 if (sb_oid_cursize(rs) > 2 && map[1] == map[2]) {
81 memmove(map + 1, map + 3, 87 memmove(map + 1, map + 3,
82 (sb_oid_cursize(rs) - 3) * sizeof(__u32)); 88 (sb_oid_cursize(rs) - 3) * sizeof(__u32));
@@ -97,30 +103,33 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
97 int i = 0; 103 int i = 0;
98 104
99 BUG_ON(!th->t_trans_id); 105 BUG_ON(!th->t_trans_id);
100 //return; 106 /*return; */
101 check_objectid_map(s, map); 107 check_objectid_map(s, map);
102 108
103 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); 109 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
104 journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s)); 110 journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s));
105 111
106 /* start at the beginning of the objectid map (i = 0) and go to 112 /*
107 the end of it (i = disk_sb->s_oid_cursize). Linear search is 113 * start at the beginning of the objectid map (i = 0) and go to
108 what we use, though it is possible that binary search would be 114 * the end of it (i = disk_sb->s_oid_cursize). Linear search is
109 more efficient after performing lots of deletions (which is 115 * what we use, though it is possible that binary search would be
110 when oids is large.) We only check even i's. */ 116 * more efficient after performing lots of deletions (which is
117 * when oids is large.) We only check even i's.
118 */
111 while (i < sb_oid_cursize(rs)) { 119 while (i < sb_oid_cursize(rs)) {
112 if (objectid_to_release == le32_to_cpu(map[i])) { 120 if (objectid_to_release == le32_to_cpu(map[i])) {
113 /* This incrementation unallocates the objectid. */ 121 /* This incrementation unallocates the objectid. */
114 //map[i]++;
115 le32_add_cpu(&map[i], 1); 122 le32_add_cpu(&map[i], 1);
116 123
117 /* Did we unallocate the last member of an odd sequence, and can shrink oids? */ 124 /*
125 * Did we unallocate the last member of an
126 * odd sequence, and can shrink oids?
127 */
118 if (map[i] == map[i + 1]) { 128 if (map[i] == map[i + 1]) {
119 /* shrink objectid map */ 129 /* shrink objectid map */
120 memmove(map + i, map + i + 2, 130 memmove(map + i, map + i + 2,
121 (sb_oid_cursize(rs) - i - 131 (sb_oid_cursize(rs) - i -
122 2) * sizeof(__u32)); 132 2) * sizeof(__u32));
123 //disk_sb->s_oid_cursize -= 2;
124 set_sb_oid_cursize(rs, sb_oid_cursize(rs) - 2); 133 set_sb_oid_cursize(rs, sb_oid_cursize(rs) - 2);
125 134
126 RFALSE(sb_oid_cursize(rs) < 2 || 135 RFALSE(sb_oid_cursize(rs) < 2 ||
@@ -135,14 +144,19 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
135 objectid_to_release < le32_to_cpu(map[i + 1])) { 144 objectid_to_release < le32_to_cpu(map[i + 1])) {
136 /* size of objectid map is not changed */ 145 /* size of objectid map is not changed */
137 if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) { 146 if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) {
138 //objectid_map[i+1]--;
139 le32_add_cpu(&map[i + 1], -1); 147 le32_add_cpu(&map[i + 1], -1);
140 return; 148 return;
141 } 149 }
142 150
143 /* JDM comparing two little-endian values for equality -- safe */ 151 /*
152 * JDM comparing two little-endian values for
153 * equality -- safe
154 */
155 /*
156 * objectid map must be expanded, but
157 * there is no space
158 */
144 if (sb_oid_cursize(rs) == sb_oid_maxsize(rs)) { 159 if (sb_oid_cursize(rs) == sb_oid_maxsize(rs)) {
145 /* objectid map must be expanded, but there is no space */
146 PROC_INFO_INC(s, leaked_oid); 160 PROC_INFO_INC(s, leaked_oid);
147 return; 161 return;
148 } 162 }
@@ -178,8 +192,9 @@ int reiserfs_convert_objectid_map_v1(struct super_block *s)
178 new_objectid_map = (__le32 *) (disk_sb + 1); 192 new_objectid_map = (__le32 *) (disk_sb + 1);
179 193
180 if (cur_size > new_size) { 194 if (cur_size > new_size) {
181 /* mark everyone used that was listed as free at the end of the objectid 195 /*
182 ** map 196 * mark everyone used that was listed as free at
197 * the end of the objectid map
183 */ 198 */
184 objectid_map[new_size - 1] = objectid_map[cur_size - 1]; 199 objectid_map[new_size - 1] = objectid_map[cur_size - 1];
185 set_sb_oid_cursize(disk_sb, new_size); 200 set_sb_oid_cursize(disk_sb, new_size);