OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [fs/] [ext2/] [ialloc.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1628 jcastillo
/*
2
 *  linux/fs/ext2/ialloc.c
3
 *
4
 * Copyright (C) 1992, 1993, 1994, 1995
5
 * Remy Card (card@masi.ibp.fr)
6
 * Laboratoire MASI - Institut Blaise Pascal
7
 * Universite Pierre et Marie Curie (Paris VI)
8
 *
9
 *  BSD ufs-inspired inode and directory allocation by
10
 *  Stephen Tweedie (sct@dcs.ed.ac.uk), 1993
11
 *  Big-endian to little-endian byte-swapping/bitmaps by
12
 *        David S. Miller (davem@caip.rutgers.edu), 1995
13
 */
14
 
15
/*
16
 * ialloc.c contains the inodes allocation and deallocation routines
17
 */
18
 
19
/*
20
 * The free inodes are managed by bitmaps.  A file system contains several
21
 * blocks groups.  Each group contains 1 bitmap block for blocks, 1 bitmap
22
 * block for inodes, N blocks for the inode table and data blocks.
23
 *
24
 * The file system contains group descriptors which are located after the
25
 * super block.  Each descriptor contains the number of the bitmap block and
26
 * the free blocks count in the block.  The descriptors are loaded in memory
27
 * when a file system is mounted (see ext2_read_super).
28
 */
29
 
30
#include <linux/fs.h>
31
#include <linux/ext2_fs.h>
32
#include <linux/sched.h>
33
#include <linux/stat.h>
34
#include <linux/string.h>
35
#include <linux/locks.h>
36
 
37
#include <asm/bitops.h>
38
#include <asm/byteorder.h>
39
 
40
static struct ext2_group_desc * get_group_desc (struct super_block * sb,
41
                                                unsigned int block_group,
42
                                                struct buffer_head ** bh)
43
{
44
        unsigned long group_desc;
45
        unsigned long desc;
46
        struct ext2_group_desc * gdp;
47
 
48
        if (block_group >= sb->u.ext2_sb.s_groups_count)
49
                ext2_panic (sb, "get_group_desc",
50
                            "block_group >= groups_count - "
51
                            "block_group = %d, groups_count = %lu",
52
                            block_group, sb->u.ext2_sb.s_groups_count);
53
 
54
        group_desc = block_group / EXT2_DESC_PER_BLOCK(sb);
55
        desc = block_group % EXT2_DESC_PER_BLOCK(sb);
56
        if (!sb->u.ext2_sb.s_group_desc[group_desc])
57
                ext2_panic (sb, "get_group_desc",
58
                            "Group descriptor not loaded - "
59
                            "block_group = %d, group_desc = %lu, desc = %lu",
60
                             block_group, group_desc, desc);
61
        gdp = (struct ext2_group_desc *)
62
                sb->u.ext2_sb.s_group_desc[group_desc]->b_data;
63
        if (bh)
64
                *bh = sb->u.ext2_sb.s_group_desc[group_desc];
65
        return gdp + desc;
66
}
67
 
68
/*
69
 * Read the inode allocation bitmap for a given block_group, reading
70
 * into the specified slot in the superblock's bitmap cache.
71
 *
72
 * Return >=0 on success or a -ve error code.
73
 */
74
 
75
static int read_inode_bitmap (struct super_block * sb,
76
                              unsigned long block_group,
77
                              unsigned int bitmap_nr)
78
{
79
        struct ext2_group_desc * gdp;
80
        struct buffer_head * bh;
81
        int retval = 0;
82
 
83
        gdp = get_group_desc (sb, block_group, NULL);
84
        bh = bread (sb->s_dev, swab32(gdp->bg_inode_bitmap), sb->s_blocksize);
85
        if (!bh) {
86
                ext2_error (sb, "read_inode_bitmap",
87
                            "Cannot read inode bitmap - "
88
                            "block_group = %lu, inode_bitmap = %lu",
89
                            block_group, (unsigned long) swab32(gdp->bg_inode_bitmap));
90
                retval = -EIO;
91
        }
92
        /*
93
         * On IO error, just leave a zero in the superblock's block pointer for
94
         * this group.  The IO will be retried next time.
95
         */
96
        sb->u.ext2_sb.s_inode_bitmap_number[bitmap_nr] = block_group;
97
        sb->u.ext2_sb.s_inode_bitmap[bitmap_nr] = bh;
98
        return retval;
99
}
100
 
101
/*
102
 * load_inode_bitmap loads the inode bitmap for a blocks group
103
 *
104
 * It maintains a cache for the last bitmaps loaded.  This cache is managed
105
 * with a LRU algorithm.
106
 *
107
 * Notes:
108
 * 1/ There is one cache per mounted file system.
109
 * 2/ If the file system contains less than EXT2_MAX_GROUP_LOADED groups,
110
 *    this function reads the bitmap without maintaining a LRU cache.
111
 *
112
 * Return the slot used to store the bitmap, or a -ve error code.
113
 */
114
static int load_inode_bitmap (struct super_block * sb,
115
                              unsigned int block_group)
116
{
117
        int i, j, retval = 0;
118
        unsigned long inode_bitmap_number;
119
        struct buffer_head * inode_bitmap;
120
 
121
        if (block_group >= sb->u.ext2_sb.s_groups_count)
122
                ext2_panic (sb, "load_inode_bitmap",
123
                            "block_group >= groups_count - "
124
                            "block_group = %d, groups_count = %lu",
125
                             block_group, sb->u.ext2_sb.s_groups_count);
126
        if (sb->u.ext2_sb.s_loaded_inode_bitmaps > 0 &&
127
            sb->u.ext2_sb.s_inode_bitmap_number[0] == block_group)
128
                return 0;
129
        if (sb->u.ext2_sb.s_groups_count <= EXT2_MAX_GROUP_LOADED) {
130
                if (sb->u.ext2_sb.s_inode_bitmap[block_group]) {
131
                        if (sb->u.ext2_sb.s_inode_bitmap_number[block_group] != block_group)
132
                                ext2_panic (sb, "load_inode_bitmap",
133
                                            "block_group != inode_bitmap_number");
134
                        else
135
                                return block_group;
136
                } else {
137
                        retval = read_inode_bitmap (sb, block_group, block_group);
138
                        if (retval < 0)
139
                                return retval;
140
                        return block_group;
141
                }
142
        }
143
 
144
        for (i = 0; i < sb->u.ext2_sb.s_loaded_inode_bitmaps &&
145
                    sb->u.ext2_sb.s_inode_bitmap_number[i] != block_group;
146
             i++)
147
                ;
148
        if (i < sb->u.ext2_sb.s_loaded_inode_bitmaps &&
149
            sb->u.ext2_sb.s_inode_bitmap_number[i] == block_group) {
150
                inode_bitmap_number = sb->u.ext2_sb.s_inode_bitmap_number[i];
151
                inode_bitmap = sb->u.ext2_sb.s_inode_bitmap[i];
152
                for (j = i; j > 0; j--) {
153
                        sb->u.ext2_sb.s_inode_bitmap_number[j] =
154
                                sb->u.ext2_sb.s_inode_bitmap_number[j - 1];
155
                        sb->u.ext2_sb.s_inode_bitmap[j] =
156
                                sb->u.ext2_sb.s_inode_bitmap[j - 1];
157
                }
158
                sb->u.ext2_sb.s_inode_bitmap_number[0] = inode_bitmap_number;
159
                sb->u.ext2_sb.s_inode_bitmap[0] = inode_bitmap;
160
 
161
                /*
162
                 * There's still one special case here --- if inode_bitmap == 0
163
                 * then our last attempt to read the bitmap failed and we have
164
                 * just ended up caching that failure.  Try again to read it.
165
                 */
166
                if (!inode_bitmap)
167
                        retval = read_inode_bitmap (sb, block_group, 0);
168
        } else {
169
                if (sb->u.ext2_sb.s_loaded_inode_bitmaps < EXT2_MAX_GROUP_LOADED)
170
                        sb->u.ext2_sb.s_loaded_inode_bitmaps++;
171
                else
172
                        brelse (sb->u.ext2_sb.s_inode_bitmap[EXT2_MAX_GROUP_LOADED - 1]);
173
                for (j = sb->u.ext2_sb.s_loaded_inode_bitmaps - 1; j > 0; j--) {
174
                        sb->u.ext2_sb.s_inode_bitmap_number[j] =
175
                                sb->u.ext2_sb.s_inode_bitmap_number[j - 1];
176
                        sb->u.ext2_sb.s_inode_bitmap[j] =
177
                                sb->u.ext2_sb.s_inode_bitmap[j - 1];
178
                }
179
                retval = read_inode_bitmap (sb, block_group, 0);
180
        }
181
        return retval;
182
}
183
 
184
void ext2_free_inode (struct inode * inode)
185
{
186
        struct super_block * sb;
187
        struct buffer_head * bh;
188
        struct buffer_head * bh2;
189
        unsigned long block_group;
190
        unsigned long bit;
191
        int bitmap_nr;
192
        struct ext2_group_desc * gdp;
193
        struct ext2_super_block * es;
194
 
195
        if (!inode)
196
                return;
197
        if (!inode->i_dev) {
198
                printk ("ext2_free_inode: inode has no device\n");
199
                return;
200
        }
201
        if (inode->i_count > 1) {
202
                printk ("ext2_free_inode: inode has count=%ld\n",
203
                        inode->i_count);
204
                return;
205
        }
206
        if (inode->i_nlink) {
207
                printk ("ext2_free_inode: inode has nlink=%d\n",
208
                        inode->i_nlink);
209
                return;
210
        }
211
        sb = inode->i_sb;
212
        if (!sb) {
213
                printk("ext2_free_inode: inode on nonexistent device\n");
214
                return;
215
        }
216
 
217
        ext2_debug ("freeing inode %lu\n", inode->i_ino);
218
 
219
        /* We need to kill quota references now, before grabbing the
220
         * superblock lock because writing the quota out to disk
221
         * may need to lock the superblock as well.
222
         *
223
         * It is safe to do this early instead of the original
224
         * places because we cannot be here in ext2_free_inode
225
         * if any other references to this inode exist at all.
226
         *
227
         * Based upon a 2.1.x fix by Bill Hawes.   --DaveM
228
         */
229
        if (sb->dq_op) {
230
                sb->dq_op->free_inode (inode, 1);
231
                if (IS_WRITABLE (inode))
232
                        sb->dq_op->drop(inode);
233
        }
234
 
235
        lock_super (sb);
236
        if (inode->i_ino < EXT2_FIRST_INO(sb) ||
237
            inode->i_ino > swab32(sb->u.ext2_sb.s_es->s_inodes_count)) {
238
                ext2_error (sb, "free_inode",
239
                            "reserved inode or nonexistent inode");
240
                unlock_super (sb);
241
                return;
242
        }
243
        es = sb->u.ext2_sb.s_es;
244
        block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(sb);
245
        bit = (inode->i_ino - 1) % EXT2_INODES_PER_GROUP(sb);
246
        bitmap_nr = load_inode_bitmap (sb, block_group);
247
        if (bitmap_nr < 0) {
248
                unlock_super (sb);
249
                return;
250
        }
251
 
252
        bh = sb->u.ext2_sb.s_inode_bitmap[bitmap_nr];
253
        if (!__ext2_clear_bit (bit, bh->b_data))
254
                ext2_warning (sb, "ext2_free_inode",
255
                              "bit already cleared for inode %lu", inode->i_ino);
256
        else {
257
                gdp = get_group_desc (sb, block_group, &bh2);
258
                gdp->bg_free_inodes_count =
259
                        swab16(swab16(gdp->bg_free_inodes_count) + 1);
260
                if (S_ISDIR(inode->i_mode))
261
                        gdp->bg_used_dirs_count =
262
                                swab16(swab16(gdp->bg_used_dirs_count) - 1);
263
                mark_buffer_dirty(bh2, 1);
264
                es->s_free_inodes_count =
265
                        swab32(swab32(es->s_free_inodes_count) + 1);
266
                mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
267
                inode->i_dirt = 0;
268
        }
269
        mark_buffer_dirty(bh, 1);
270
        if (sb->s_flags & MS_SYNCHRONOUS) {
271
                ll_rw_block (WRITE, 1, &bh);
272
                wait_on_buffer (bh);
273
        }
274
        sb->s_dirt = 1;
275
        clear_inode (inode);
276
        unlock_super (sb);
277
}
278
 
279
/*
280
 * This function increments the inode version number
281
 *
282
 * This may be used one day by the NFS server
283
 */
284
static void inc_inode_version (struct inode * inode,
285
                               struct ext2_group_desc *gdp,
286
                               int mode)
287
{
288
        inode->u.ext2_i.i_version++;
289
        inode->i_dirt = 1;
290
 
291
        return;
292
}
293
 
294
/*
295
 * There are two policies for allocating an inode.  If the new inode is
296
 * a directory, then a forward search is made for a block group with both
297
 * free space and a low directory-to-inode ratio; if that fails, then of
298
 * the groups with above-average free space, that group with the fewest
299
 * directories already is chosen.
300
 *
301
 * For other inodes, search forward from the parent directory\'s block
302
 * group to find a free inode.
303
 */
304
struct inode * ext2_new_inode (const struct inode * dir, int mode, int * err)
305
{
306
        struct super_block * sb;
307
        struct buffer_head * bh;
308
        struct buffer_head * bh2;
309
        int i, j, avefreei;
310
        struct inode * inode;
311
        int bitmap_nr;
312
        struct ext2_group_desc * gdp;
313
        struct ext2_group_desc * tmp;
314
        struct ext2_super_block * es;
315
 
316
        if (!dir || !(inode = get_empty_inode ()))
317
        {
318
                *err=-ENOMEM;
319
                return NULL;
320
        }
321
        sb = dir->i_sb;
322
        inode->i_sb = sb;
323
        inode->i_flags = sb->s_flags;
324
        lock_super (sb);
325
        es = sb->u.ext2_sb.s_es;
326
repeat:
327
        gdp = NULL; i=0;
328
 
329
        *err = -ENOSPC;
330
        if (S_ISDIR(mode)) {
331
                avefreei = swab32(es->s_free_inodes_count) /
332
                        sb->u.ext2_sb.s_groups_count;
333
/* I am not yet convinced that this next bit is necessary.
334
                i = dir->u.ext2_i.i_block_group;
335
                for (j = 0; j < sb->u.ext2_sb.s_groups_count; j++) {
336
                        tmp = get_group_desc (sb, i, &bh2);
337
                        if ((swab16(tmp->bg_used_dirs_count) << 8) <
338
                            swab16(tmp->bg_free_inodes_count)) {
339
                                gdp = tmp;
340
                                break;
341
                        }
342
                        else
343
                        i = ++i % sb->u.ext2_sb.s_groups_count;
344
                }
345
*/
346
                if (!gdp) {
347
                        for (j = 0; j < sb->u.ext2_sb.s_groups_count; j++) {
348
                                tmp = get_group_desc (sb, j, &bh2);
349
                                if (swab16(tmp->bg_free_inodes_count) &&
350
                                        swab16(tmp->bg_free_inodes_count) >= avefreei) {
351
                                        if (!gdp ||
352
                                            (swab16(tmp->bg_free_blocks_count) >
353
                                             swab16(gdp->bg_free_blocks_count))) {
354
                                                i = j;
355
                                                gdp = tmp;
356
                                        }
357
                                }
358
                        }
359
                }
360
        }
361
        else
362
        {
363
                /*
364
                 * Try to place the inode in its parent directory
365
                 */
366
                i = dir->u.ext2_i.i_block_group;
367
                tmp = get_group_desc (sb, i, &bh2);
368
                if (swab16(tmp->bg_free_inodes_count))
369
                        gdp = tmp;
370
                else
371
                {
372
                        /*
373
                         * Use a quadratic hash to find a group with a
374
                         * free inode
375
                         */
376
                        for (j = 1; j < sb->u.ext2_sb.s_groups_count; j <<= 1) {
377
                                i += j;
378
                                if (i >= sb->u.ext2_sb.s_groups_count)
379
                                        i -= sb->u.ext2_sb.s_groups_count;
380
                                tmp = get_group_desc (sb, i, &bh2);
381
                                if (swab16(tmp->bg_free_inodes_count)) {
382
                                        gdp = tmp;
383
                                        break;
384
                                }
385
                        }
386
                }
387
                if (!gdp) {
388
                        /*
389
                         * That failed: try linear search for a free inode
390
                         */
391
                        i = dir->u.ext2_i.i_block_group + 1;
392
                        for (j = 2; j < sb->u.ext2_sb.s_groups_count; j++) {
393
                                if (++i >= sb->u.ext2_sb.s_groups_count)
394
                                        i = 0;
395
                                tmp = get_group_desc (sb, i, &bh2);
396
                                if (swab16(tmp->bg_free_inodes_count)) {
397
                                        gdp = tmp;
398
                                        break;
399
                                }
400
                        }
401
                }
402
        }
403
 
404
        if (!gdp) {
405
                unlock_super (sb);
406
                iput(inode);
407
                return NULL;
408
        }
409
        bitmap_nr = load_inode_bitmap (sb, i);
410
        if (bitmap_nr < 0) {
411
                unlock_super (sb);
412
                iput(inode);
413
                *err = -EIO;
414
                return NULL;
415
        }
416
 
417
        bh = sb->u.ext2_sb.s_inode_bitmap[bitmap_nr];
418
        if ((j = __ext2_find_first_zero_bit ((unsigned long *) bh->b_data,
419
                                      EXT2_INODES_PER_GROUP(sb))) <
420
            EXT2_INODES_PER_GROUP(sb)) {
421
                if (__ext2_set_bit (j, bh->b_data)) {
422
                        ext2_warning (sb, "ext2_new_inode",
423
                                      "bit already set for inode %d", j);
424
                        goto repeat;
425
                }
426
                mark_buffer_dirty(bh, 1);
427
                if (sb->s_flags & MS_SYNCHRONOUS) {
428
                        ll_rw_block (WRITE, 1, &bh);
429
                        wait_on_buffer (bh);
430
                }
431
        } else {
432
                if (swab16(gdp->bg_free_inodes_count) != 0) {
433
                        ext2_error (sb, "ext2_new_inode",
434
                                    "Free inodes count corrupted in group %d",
435
                                    i);
436
                        unlock_super (sb);
437
                        iput (inode);
438
                        return NULL;
439
                }
440
                goto repeat;
441
        }
442
        j += i * EXT2_INODES_PER_GROUP(sb) + 1;
443
        if (j < EXT2_FIRST_INO(sb) || j > swab32(es->s_inodes_count)) {
444
                ext2_error (sb, "ext2_new_inode",
445
                            "reserved inode or inode > inodes count - "
446
                            "block_group = %d,inode=%d", i, j);
447
                unlock_super (sb);
448
                iput (inode);
449
                return NULL;
450
        }
451
        gdp->bg_free_inodes_count =
452
                swab16(swab16(gdp->bg_free_inodes_count) - 1);
453
        if (S_ISDIR(mode))
454
                gdp->bg_used_dirs_count =
455
                        swab16(swab16(gdp->bg_used_dirs_count) + 1);
456
        mark_buffer_dirty(bh2, 1);
457
        es->s_free_inodes_count =
458
                swab32(swab32(es->s_free_inodes_count) - 1);
459
        mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
460
        sb->s_dirt = 1;
461
        inode->i_mode = mode;
462
        inode->i_sb = sb;
463
        inode->i_count = 1;
464
        inode->i_nlink = 1;
465
        inode->i_dev = sb->s_dev;
466
        inode->i_uid = current->fsuid;
467
        if (test_opt (sb, GRPID))
468
                inode->i_gid = dir->i_gid;
469
        else if (dir->i_mode & S_ISGID) {
470
                inode->i_gid = dir->i_gid;
471
                if (S_ISDIR(mode))
472
                        mode |= S_ISGID;
473
        } else
474
                inode->i_gid = current->fsgid;
475
        inode->i_dirt = 1;
476
        inode->i_ino = j;
477
        inode->i_blksize = PAGE_SIZE;   /* This is the optimal IO size (for stat), not the fs block size */
478
        inode->i_blocks = 0;
479
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
480
        inode->u.ext2_i.i_new_inode = 1;
481
        inode->u.ext2_i.i_flags = dir->u.ext2_i.i_flags;
482
        if (S_ISLNK(mode))
483
                inode->u.ext2_i.i_flags &= ~(EXT2_IMMUTABLE_FL | EXT2_APPEND_FL);
484
        inode->u.ext2_i.i_faddr = 0;
485
        inode->u.ext2_i.i_frag_no = 0;
486
        inode->u.ext2_i.i_frag_size = 0;
487
        inode->u.ext2_i.i_file_acl = 0;
488
        inode->u.ext2_i.i_dir_acl = 0;
489
        inode->u.ext2_i.i_dtime = 0;
490
        inode->u.ext2_i.i_block_group = i;
491
        inode->i_op = NULL;
492
        if (inode->u.ext2_i.i_flags & EXT2_SYNC_FL)
493
                inode->i_flags |= MS_SYNCHRONOUS;
494
        insert_inode_hash(inode);
495
        inc_inode_version (inode, gdp, mode);
496
 
497
        unlock_super (sb);
498
        if (sb->dq_op) {
499
                sb->dq_op->initialize (inode, -1);
500
                if (sb->dq_op->alloc_inode (inode, 1)) {
501
                        sb->dq_op->drop (inode);
502
                        inode->i_nlink = 0;
503
                        iput (inode);
504
                        *err = -EDQUOT;
505
                        return NULL;
506
                }
507
                inode->i_flags |= S_WRITE;
508
        }
509
        ext2_debug ("allocating inode %lu\n", inode->i_ino);
510
 
511
        *err = 0;
512
        return inode;
513
}
514
 
515
unsigned long ext2_count_free_inodes (struct super_block * sb)
516
{
517
#ifdef EXT2FS_DEBUG
518
        struct ext2_super_block * es;
519
        unsigned long desc_count, bitmap_count, x;
520
        int bitmap_nr;
521
        struct ext2_group_desc * gdp;
522
        int i;
523
 
524
        lock_super (sb);
525
        es = sb->u.ext2_sb.s_es;
526
        desc_count = 0;
527
        bitmap_count = 0;
528
        gdp = NULL;
529
        for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) {
530
                gdp = get_group_desc (sb, i, NULL);
531
                desc_count += swab16(gdp->bg_free_inodes_count);
532
                bitmap_nr = load_inode_bitmap (sb, i);
533
                if (bitmap_nr < 0)
534
                        continue;
535
 
536
                x = ext2_count_free (sb->u.ext2_sb.s_inode_bitmap[bitmap_nr],
537
                                     EXT2_INODES_PER_GROUP(sb) / 8);
538
                printk ("group %d: stored = %d, counted = %lu\n",
539
                        i, swab16(gdp->bg_free_inodes_count), x);
540
                bitmap_count += x;
541
        }
542
        printk("ext2_count_free_inodes: stored = %lu, computed = %lu, %lu\n",
543
                swab32(es->s_free_inodes_count), desc_count, bitmap_count);
544
        unlock_super (sb);
545
        return desc_count;
546
#else
547
        return swab32(sb->u.ext2_sb.s_es->s_free_inodes_count);
548
#endif
549
}
550
 
551
void ext2_check_inodes_bitmap (struct super_block * sb)
552
{
553
        struct ext2_super_block * es;
554
        unsigned long desc_count, bitmap_count, x;
555
        int bitmap_nr;
556
        struct ext2_group_desc * gdp;
557
        int i;
558
 
559
        lock_super (sb);
560
        es = sb->u.ext2_sb.s_es;
561
        desc_count = 0;
562
        bitmap_count = 0;
563
        gdp = NULL;
564
        for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) {
565
                gdp = get_group_desc (sb, i, NULL);
566
                desc_count += swab16(gdp->bg_free_inodes_count);
567
                bitmap_nr = load_inode_bitmap (sb, i);
568
                if (bitmap_nr < 0)
569
                        continue;
570
 
571
                x = ext2_count_free (sb->u.ext2_sb.s_inode_bitmap[bitmap_nr],
572
                                     EXT2_INODES_PER_GROUP(sb) / 8);
573
                if (swab16(gdp->bg_free_inodes_count) != x)
574
                        ext2_error (sb, "ext2_check_inodes_bitmap",
575
                                    "Wrong free inodes count in group %d, "
576
                                    "stored = %d, counted = %lu", i,
577
                                    swab16(gdp->bg_free_inodes_count), x);
578
                bitmap_count += x;
579
        }
580
        if (swab32(es->s_free_inodes_count) != bitmap_count)
581
                ext2_error (sb, "ext2_check_inodes_bitmap",
582
                            "Wrong free inodes count in super block, "
583
                            "stored = %lu, counted = %lu",
584
                            (unsigned long) swab32(es->s_free_inodes_count),
585
                            bitmap_count);
586
        unlock_super (sb);
587
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.