/[gentoo-x86]/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.21-fix_large_fs.patch
Gentoo

Contents of /sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.21-fix_large_fs.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Sep 21 21:06:41 2011 UTC (6 years, 8 months ago) by alexxy
Branch: MAIN
CVS Tags: HEAD
[sys-fs/reiserfsprogs] Add patch to fix large >4T fs

(Portage version: 2.2.0_alpha59/cvs/Linux x86_64)

1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] reiserfs: Fix signedness issues for large file systems
3 References: bnc#701602
4
5
6 Signed-by: Jeff Mahoney <jeffm@suse.com>
7 ---
8 debugreiserfs/debugreiserfs.c | 22 +++++++++++-----------
9 debugreiserfs/pack.c | 18 +++++++++---------
10 debugreiserfs/scan.c | 2 +-
11 debugreiserfs/stat.c | 2 +-
12 fsck/check_tree.c | 6 +++---
13 fsck/pass0.c | 10 +++++-----
14 fsck/pass1.c | 4 ++--
15 include/reiserfs_fs.h | 2 ++
16 lib/io.c | 2 +-
17 reiserfscore/journal.c | 2 +-
18 reiserfscore/prints.c | 14 +++++++-------
19 reiserfscore/reiserfslib.c | 5 +++--
20 reiserfscore/stree.c | 2 +-
21 13 files changed, 47 insertions(+), 44 deletions(-)
22
23 --- a/debugreiserfs/debugreiserfs.c
24 +++ b/debugreiserfs/debugreiserfs.c
25 @@ -59,11 +59,11 @@ Options:\n\
26
27 #if 1
28 struct reiserfs_fsstat {
29 - int nr_internals;
30 - int nr_leaves;
31 - int nr_files;
32 - int nr_directories;
33 - int nr_unformatted;
34 + unsigned int nr_internals;
35 + unsigned int nr_leaves;
36 + unsigned int nr_files;
37 + unsigned int nr_directories;
38 + unsigned int nr_unformatted;
39 } g_stat_info;
40 #endif
41
42 @@ -465,14 +465,14 @@ static void init_bitmap (reiserfs_filsys
43 case ALL_BLOCKS:
44 input_bitmap (fs) = reiserfs_create_bitmap (block_count);
45 reiserfs_bitmap_fill (input_bitmap (fs));
46 - reiserfs_warning (stderr, "Whole device (%d blocks) is to be scanned\n",
47 + reiserfs_warning (stderr, "Whole device (%u blocks) is to be scanned\n",
48 reiserfs_bitmap_ones (input_bitmap (fs)));
49 break;
50 case USED_BLOCKS:
51 reiserfs_warning (stderr, "Loading on-disk bitmap .. ");
52 input_bitmap (fs) = reiserfs_create_bitmap (block_count);
53 reiserfs_bitmap_copy (input_bitmap (fs), fs->fs_bitmap2);
54 - reiserfs_warning (stderr, "%d bits set - done\n",
55 + reiserfs_warning (stderr, "%lu bits set - done\n",
56 reiserfs_bitmap_ones (input_bitmap (fs)));
57 break;
58 case UNUSED_BLOCKS:
59 @@ -480,7 +480,7 @@ static void init_bitmap (reiserfs_filsys
60 input_bitmap (fs) = reiserfs_create_bitmap (block_count);
61 reiserfs_bitmap_copy (input_bitmap (fs), fs->fs_bitmap2);
62 reiserfs_bitmap_invert (input_bitmap (fs));
63 - reiserfs_warning (stderr, "%d bits set - done\n",
64 + reiserfs_warning (stderr, "%lu bits set - done\n",
65 reiserfs_bitmap_ones (input_bitmap (fs)));
66 break;
67 case EXTERN_BITMAP:
68 @@ -494,7 +494,7 @@ static void init_bitmap (reiserfs_filsys
69 reiserfs_exit (1, "could not load fitmap from \"%s\"",
70 input_bitmap_file_name(fs));
71 }
72 - reiserfs_warning (stderr, "%d blocks marked in the given bitmap\n",
73 + reiserfs_warning (stderr, "%u blocks marked in the given bitmap\n",
74 reiserfs_bitmap_ones (input_bitmap (fs)));
75 fclose (fp);
76 break;
77 @@ -554,8 +554,8 @@ static void do_dump_tree (reiserfs_filsy
78 }
79
80 /* print the statistic */
81 - printf ("\t%d internal + %d leaves + %d "
82 - "unformatted nodes = %d blocks\n",
83 + printf ("\t%u internal + %u leaves + %u "
84 + "unformatted nodes = %u blocks\n",
85 g_stat_info.nr_internals, g_stat_info.nr_leaves,
86 g_stat_info.nr_unformatted, g_stat_info.nr_internals +
87 g_stat_info.nr_leaves + g_stat_info.nr_unformatted);
88 --- a/debugreiserfs/pack.c
89 +++ b/debugreiserfs/pack.c
90 @@ -8,7 +8,7 @@
91
92
93 /* counters for each kind of blocks */
94 -int packed,
95 +unsigned int packed,
96 packed_leaves,
97 full_blocks,
98 having_ih_array, /* blocks with broken block head */
99 @@ -638,7 +638,7 @@ static void pack_frozen_data (reiserfs_f
100 }
101 reiserfs_warning (stderr, "ok\n");fflush (stderr);
102 reiserfs_warning (stderr,
103 - "Super block, bitmaps, journal - %d blocks - done, %d blocks left\n",
104 + "Super block, bitmaps, journal - %u blocks - done, %u blocks left\n",
105 packed, reiserfs_bitmap_ones (what_to_pack));
106 }
107
108 @@ -693,13 +693,13 @@ void pack_partition (reiserfs_filsys_t *
109 magic16 = END_MAGIC;
110 fwrite_le16 (&magic16);
111
112 - fprintf (stderr, "\nPacked %d blocks:\n"
113 - "\tcompessed %d\n"
114 - "\tfull blocks %d\n"
115 - "\t\tleaves with broken block head %d\n"
116 - "\t\tcorrupted leaves %d\n"
117 - "\t\tinternals %d\n"
118 - "\t\tdescriptors %d\n",
119 + fprintf (stderr, "\nPacked %u blocks:\n"
120 + "\tcompessed %u\n"
121 + "\tfull blocks %u\n"
122 + "\t\tleaves with broken block head %u\n"
123 + "\t\tcorrupted leaves %u\n"
124 + "\t\tinternals %u\n"
125 + "\t\tdescriptors %u\n",
126 packed,
127 packed_leaves, full_blocks, having_ih_array,
128 bad_leaves, internals, descs);
129 --- a/debugreiserfs/scan.c
130 +++ b/debugreiserfs/scan.c
131 @@ -1032,7 +1032,7 @@ void do_scan (reiserfs_filsys_t * fs)
132 /* step 2: */
133 done = 0;
134 total = reiserfs_bitmap_ones (input_bitmap (fs));
135 - printf ("%ld bits set in bitmap\n", total);
136 + printf ("%lu bits set in bitmap\n", total);
137 for (i = 0; i < get_sb_block_count (fs->fs_ondisk_sb); i ++) {
138 int type;
139
140 --- a/debugreiserfs/stat.c
141 +++ b/debugreiserfs/stat.c
142 @@ -245,7 +245,7 @@ void do_stat (reiserfs_filsys_t * fs)
143 reiserfs_exit (1, "could not open %s to save bitmap: %m\n",
144 input_bitmap_file_name(fs));
145 }
146 - reiserfs_warning (stderr, "Updated bitmap contains %d blocks marked\n",
147 + reiserfs_warning (stderr, "Updated bitmap contains %u blocks marked\n",
148 reiserfs_bitmap_ones (input_bitmap (fs)));
149
150 reiserfs_bitmap_save (fp, input_bitmap (fs));
151 --- a/fsck/check_tree.c
152 +++ b/fsck/check_tree.c
153 @@ -119,7 +119,7 @@ static int is_block_free (reiserfs_filsy
154 }
155
156
157 -/*static int hits = 0;*/
158 +/*static unsigned int hits = 0;*/
159
160 /* we have seen this block in the tree, mark corresponding bit in the
161 control bitmap */
162 @@ -156,7 +156,7 @@ static void init_control_bitmap (reiserf
163 for (i = 0; i <= fs->fs_super_bh->b_blocknr; i ++)
164 we_met_it (i);
165
166 - /*printf ("SKIPPED: %d blocks marked used (%d)\n", hits,
167 + /*printf ("SKIPPED: %u blocks marked used (%d)\n", hits,
168 reiserfs_bitmap_zeros (control_bitmap));
169 hits = 0;*/
170
171 @@ -172,7 +172,7 @@ static void init_control_bitmap (reiserf
172 block ++;
173 }
174
175 - /*printf ("BITMAPS: %d blocks marked used (%d)\n", hits,
176 + /*printf ("BITMAPS: %u blocks marked used (%d)\n", hits,
177 reiserfs_bitmap_zeros (control_bitmap));
178
179 hits = 0;*/
180 --- a/fsck/pass0.c
181 +++ b/fsck/pass0.c
182 @@ -1759,7 +1759,7 @@ static void init_source_bitmap (reiserfs
183 case ALL_BLOCKS:
184 fsck_source_bitmap (fs) = reiserfs_create_bitmap (block_count);
185 reiserfs_bitmap_fill (fsck_source_bitmap (fs));
186 - fsck_progress ("The whole partition (%d blocks) is to be scanned\n",
187 + fsck_progress ("The whole partition (%u blocks) is to be scanned\n",
188 reiserfs_bitmap_ones (fsck_source_bitmap (fs)));
189 break;
190
191 @@ -1768,7 +1768,7 @@ static void init_source_bitmap (reiserfs
192 fsck_source_bitmap (fs) = reiserfs_create_bitmap (block_count);
193 reiserfs_bitmap_copy (fsck_source_bitmap (fs), fs->fs_bitmap2);
194
195 - fsck_progress ("ok, %d blocks marked used\n",
196 + fsck_progress ("ok, %u blocks marked used\n",
197 reiserfs_bitmap_ones (fsck_source_bitmap (fs)));
198 break;
199
200 @@ -1787,7 +1787,7 @@ static void init_source_bitmap (reiserfs
201 fsck_data (fs)->rebuild.bitmap_file_name);
202 }
203
204 - fsck_progress ("%d blocks marked used in extern bitmap\n",
205 + fsck_progress ("%u blocks marked used in extern bitmap\n",
206 reiserfs_bitmap_ones (fsck_source_bitmap (fs)));
207 fclose (fp);
208 break;
209 @@ -1863,8 +1863,8 @@ static void init_source_bitmap (reiserfs
210
211 fsck_source_bitmap (fs)->bm_set_bits = reiserfs_bitmap_ones (fsck_source_bitmap (fs));
212
213 - fsck_progress ("Skipping %d blocks (super block, journal, "
214 - "bitmaps) %d blocks will be read\n", tmp, fsck_source_bitmap (fs)->bm_set_bits);
215 + fsck_progress ("Skipping %u blocks (super block, journal, "
216 + "bitmaps) %u blocks will be read\n", tmp, fsck_source_bitmap (fs)->bm_set_bits);
217
218 }
219
220 --- a/fsck/pass1.c
221 +++ b/fsck/pass1.c
222 @@ -646,8 +646,8 @@ void load_pass_1_result (FILE * fp, reis
223 fetch_objectid_map (proper_id_map (fs), fs);
224 */
225
226 - fsck_progress ("Pass 1 result loaded. %d blocks used, %d allocable, "
227 - "still to be inserted %d\n",
228 + fsck_progress ("Pass 1 result loaded. %u blocks used, %u allocable, "
229 + "still to be inserted %u\n",
230 reiserfs_bitmap_ones (fsck_new_bitmap (fs)),
231 reiserfs_bitmap_zeros (fsck_allocable_bitmap (fs)),
232 reiserfs_bitmap_zeros (fsck_uninsertables (fs)));
233 --- a/include/reiserfs_fs.h
234 +++ b/include/reiserfs_fs.h
235 @@ -32,6 +32,8 @@
236 #ifndef REISERFSPROGS_FS_H
237 #define REISERFSPRIGS_FS_H
238
239 +typedef unsigned int blocknr_t;
240 +
241 #ifndef NO_EXTERN_INLINE
242 # define extern_inline extern inline
243 #else
244 --- a/lib/io.c
245 +++ b/lib/io.c
246 @@ -628,7 +628,7 @@ void close_rollback_file () {
247 return;
248 fwrite (&rollback_blocks_number, sizeof (rollback_blocksize), 1, s_rollback_file);
249 if (log_file != 0)
250 - fprintf (log_file, "rollback: %d blocks backed up\n", rollback_blocks_number);
251 + fprintf (log_file, "rollback: %u blocks backed up\n", rollback_blocks_number);
252 }
253
254 fclose (s_rollback_file);
255 --- a/reiserfscore/journal.c
256 +++ b/reiserfscore/journal.c
257 @@ -577,7 +577,7 @@ int reiserfs_create_journal(
258 {
259 /* host device does not contain enough blocks */
260 reiserfs_warning (stderr, "reiserfs_create_journal: cannot create "
261 - "a journal of %lu blocks with %lu offset on %d blocks\n",
262 + "a journal of %lu blocks with %lu offset on %u blocks\n",
263 len, offset, get_sb_block_count(sb));
264 return 0;
265 }
266 --- a/reiserfscore/prints.c
267 +++ b/reiserfscore/prints.c
268 @@ -148,7 +148,7 @@ static int print_disk_child (FILE * stre
269 int len;
270
271 dc = *((const struct disk_child **)(args[0]));
272 - len = asprintf (&buffer, "[dc_number=%u, dc_size=%u]", get_dc_child_blocknr (dc),
273 + len = asprintf (&buffer, "[dc_number=%lu, dc_size=%u]", get_dc_child_blocknr (dc),
274 get_dc_child_size (dc));
275 FPRINTF;
276 }
277 @@ -373,9 +373,9 @@ static void print_sequence (FILE * fp, _
278 return;
279
280 if (len == 1)
281 - reiserfs_warning (fp, " %d", le32_to_cpu (start));
282 + reiserfs_warning (fp, " %u", le32_to_cpu (start));
283 else
284 - reiserfs_warning (fp, " %d(%d)", le32_to_cpu (start), len);
285 + reiserfs_warning (fp, " %u(%d)", le32_to_cpu (start), len);
286 }
287
288
289 @@ -491,7 +491,7 @@ static int print_internal (FILE * fp, st
290 to = last < B_NR_ITEMS (bh) ? last : B_NR_ITEMS (bh);
291 }
292
293 - reiserfs_warning (fp, "INTERNAL NODE (%ld) contains %b\n", bh->b_blocknr, bh);
294 + reiserfs_warning (fp, "INTERNAL NODE (%lu) contains %b\n", bh->b_blocknr, bh);
295
296 dc = B_N_CHILD (bh, from);
297 reiserfs_warning (fp, "PTR %d: %y ", from, dc);
298 @@ -527,7 +527,7 @@ static int print_leaf (FILE * fp, reiser
299
300 reiserfs_warning (fp,
301 "\n===================================================================\n");
302 - reiserfs_warning (fp, "LEAF NODE (%ld) contains %b (real items %d)\n",
303 + reiserfs_warning (fp, "LEAF NODE (%lu) contains %b (real items %d)\n",
304 bh->b_blocknr, bh, real_nr);
305
306 if (!(print_mode & PRINT_TREE_DETAILS)) {
307 @@ -761,7 +761,7 @@ void print_block (FILE * fp, reiserfs_fi
308 if (print_super_block (fp, fs, file_name, bh, 0))
309 if (print_leaf (fp, fs, bh, mode, first, last))
310 if (print_internal (fp, bh, first, last))
311 - reiserfs_warning (fp, "Block %ld contains unformatted data\n", bh->b_blocknr);
312 + reiserfs_warning (fp, "Block %lu contains unformatted data\n", bh->b_blocknr);
313 }
314
315
316 @@ -797,7 +797,7 @@ void print_tb (int mode, int item_pos, i
317 tbSh = 0;
318 tbFh = 0;
319 }
320 - printf ("* %u * %3lu(%2lu) * %3lu(%2lu) * %3lu(%2lu) * %5ld * %5ld * %5ld * %5ld * %5ld *\n",
321 + printf ("* %u * %3lu(%2lu) * %3lu(%2lu) * %3lu(%2lu) * %5lu * %5lu * %5lu * %5lu * %5lu *\n",
322 h,
323 tbSh ? tbSh->b_blocknr : ~0ul,
324 tbSh ? tbSh->b_count : ~0ul,
325 --- a/reiserfscore/reiserfslib.c
326 +++ b/reiserfscore/reiserfslib.c
327 @@ -59,7 +59,8 @@ reiserfs_filsys_t * reiserfs_open (char
328 reiserfs_filsys_t * fs;
329 struct buffer_head * bh;
330 struct reiserfs_super_block * sb;
331 - int fd, i;
332 + int fd;
333 + unsigned int i;
334
335 /* convert root dir key and parent root dir key to little endian format */
336 make_const_keys ();
337 @@ -200,7 +201,7 @@ reiserfs_filsys_t * reiserfs_create (cha
338 block_size, block_count, 0))
339 {
340 reiserfs_warning (stderr, "reiserfs_create: can not create that small "
341 - "(%d blocks) filesystem\n", block_count);
342 + "(%u blocks) filesystem\n", block_count);
343 return 0;
344 }
345
346 --- a/reiserfscore/stree.c
347 +++ b/reiserfscore/stree.c
348 @@ -313,7 +313,7 @@ int search_by_key (reiserfs_filsys_t * f
349 int n_stop_level) /* How far down the tree to search.*/
350 {
351 struct reiserfs_super_block * sb;
352 - int n_block_number,
353 + unsigned int n_block_number,
354 expected_level,
355 n_block_size = fs->fs_blocksize;
356 struct buffer_head * p_s_bh;

  ViewVC Help
Powered by ViewVC 1.1.20