Whamcloud - gitweb
file llobdstat.pl was initially added on branch b_devel.
[fs/lustre-release.git] / lustre / extN / patch-2.4.18-chaos22
1 diff -ru lum-2.4.18-um30/fs/ext3/balloc.c uml-2.4.18-12.5/fs/ext3/balloc.c
2 --- lum-2.4.18-um30/fs/ext3/balloc.c    Mon Feb 25 12:38:08 2002
3 +++ uml-2.4.18-12.5/fs/ext3/balloc.c    Thu Sep 19 13:40:11 2002
4 @@ -276,7 +276,8 @@
5         }
6         lock_super (sb);
7         es = sb->u.ext3_sb.s_es;
8 -       if (block < le32_to_cpu(es->s_first_data_block) || 
9 +       if (block < le32_to_cpu(es->s_first_data_block) ||
10 +           block + count < block ||
11             (block + count) > le32_to_cpu(es->s_blocks_count)) {
12                 ext3_error (sb, "ext3_free_blocks",
13                             "Freeing blocks not in datazone - "
14 @@ -309,17 +310,6 @@
15         if (!gdp)
16                 goto error_return;
17  
18 -       if (in_range (le32_to_cpu(gdp->bg_block_bitmap), block, count) ||
19 -           in_range (le32_to_cpu(gdp->bg_inode_bitmap), block, count) ||
20 -           in_range (block, le32_to_cpu(gdp->bg_inode_table),
21 -                     sb->u.ext3_sb.s_itb_per_group) ||
22 -           in_range (block + count - 1, le32_to_cpu(gdp->bg_inode_table),
23 -                     sb->u.ext3_sb.s_itb_per_group))
24 -               ext3_error (sb, "ext3_free_blocks",
25 -                           "Freeing blocks in system zones - "
26 -                           "Block = %lu, count = %lu",
27 -                           block, count);
28 -
29         /*
30          * We are about to start releasing blocks in the bitmap,
31          * so we need undo access.
32 @@ -345,14 +335,24 @@
33         if (err)
34                 goto error_return;
35  
36 -       for (i = 0; i < count; i++) {
37 +       for (i = 0; i < count; i++, block++) {
38 +               if (block == le32_to_cpu(gdp->bg_block_bitmap) ||
39 +                   block == le32_to_cpu(gdp->bg_inode_bitmap) ||
40 +                   in_range(block, le32_to_cpu(gdp->bg_inode_table),
41 +                            sb->u.ext2_sb.s_itb_per_group)) {
42 +                       ext3_error(sb, __FUNCTION__,
43 +                                  "Freeing block in system zone - block = %lu",
44 +                                  block);
45 +                       continue;
46 +               }
47 +
48                 /*
49                  * An HJ special.  This is expensive...
50                  */
51  #ifdef CONFIG_JBD_DEBUG
52                 {
53                         struct buffer_head *debug_bh;
54 -                       debug_bh = sb_get_hash_table(sb, block + i);
55 +                       debug_bh = sb_get_hash_table(sb, block);
56                         if (debug_bh) {
57                                 BUFFER_TRACE(debug_bh, "Deleted!");
58                                 if (!bh2jh(bitmap_bh)->b_committed_data)
59 @@ -365,9 +365,8 @@
60  #endif
61                 BUFFER_TRACE(bitmap_bh, "clear bit");
62                 if (!ext3_clear_bit (bit + i, bitmap_bh->b_data)) {
63 -                       ext3_error (sb, __FUNCTION__,
64 -                                     "bit already cleared for block %lu", 
65 -                                     block + i);
66 +                       ext3_error(sb, __FUNCTION__,
67 +                                  "bit already cleared for block %lu", block);
68                         BUFFER_TRACE(bitmap_bh, "bit already cleared");
69                 } else {
70                         dquot_freed_blocks++;
71 @@ -415,7 +417,6 @@
72         if (!err) err = ret;
73  
74         if (overflow && !err) {
75 -               block += count;
76                 count = overflow;
77                 goto do_more;
78         }
79 @@ -575,6 +577,7 @@
80  
81         ext3_debug ("goal=%lu.\n", goal);
82  
83 +repeat:
84         /*
85          * First, test whether the goal block is free.
86          */
87 @@ -684,10 +686,21 @@
88         if (tmp == le32_to_cpu(gdp->bg_block_bitmap) ||
89             tmp == le32_to_cpu(gdp->bg_inode_bitmap) ||
90             in_range (tmp, le32_to_cpu(gdp->bg_inode_table),
91 -                     sb->u.ext3_sb.s_itb_per_group))
92 -               ext3_error (sb, "ext3_new_block",
93 -                           "Allocating block in system zone - "
94 -                           "block = %u", tmp);
95 +                     EXT3_SB(sb)->s_itb_per_group)) {
96 +               ext3_error(sb, __FUNCTION__,
97 +                          "Allocating block in system zone - block = %u", tmp);
98 +
99 +               /* Note: This will potentially use up one of the handle's
100 +                * buffer credits.  Normally we have way too many credits,
101 +                * so that is OK.  In _very_ rare cases it might not be OK.
102 +                * We will trigger an assertion if we run out of credits,
103 +                * and we will have to do a full fsck of the filesystem -
104 +                * better than randomly corrupting filesystem metadata.
105 +                */
106 +               ext3_set_bit(j, bh->b_data);
107 +               goto repeat;
108 +       }
109 +
110  
111         /* The superblock lock should guard against anybody else beating
112          * us to this point! */
113 diff -ru lum-2.4.18-um30/fs/ext3/namei.c uml-2.4.18-12.5/fs/ext3/namei.c
114 --- lum-2.4.18-um30/fs/ext3/namei.c     Fri Nov  9 15:25:04 2001
115 +++ uml-2.4.18-12.5/fs/ext3/namei.c     Thu Sep 19 13:40:11 2002
116 @@ -354,8 +355,8 @@
117                          */
118                         dir->i_mtime = dir->i_ctime = CURRENT_TIME;
119                         dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
120 -                       ext3_mark_inode_dirty(handle, dir);
121                         dir->i_version = ++event;
122 +                       ext3_mark_inode_dirty(handle, dir);
123                         BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
124                         ext3_journal_dirty_metadata(handle, bh);
125                         brelse(bh);
126 @@ -464,8 +465,8 @@
127                 inode->i_op = &ext3_file_inode_operations;
128                 inode->i_fop = &ext3_file_operations;
129                 inode->i_mapping->a_ops = &ext3_aops;
130 -               ext3_mark_inode_dirty(handle, inode);
131                 err = ext3_add_nondir(handle, dentry, inode);
132 +               ext3_mark_inode_dirty(handle, inode);
133         }
134         ext3_journal_stop(handle, dir);
135         return err;
136 @@ -489,8 +490,8 @@
137         err = PTR_ERR(inode);
138         if (!IS_ERR(inode)) {
139                 init_special_inode(inode, mode, rdev);
140 -               ext3_mark_inode_dirty(handle, inode);
141                 err = ext3_add_nondir(handle, dentry, inode);
142 +               ext3_mark_inode_dirty(handle, inode);
143         }
144         ext3_journal_stop(handle, dir);
145         return err;
146 @@ -933,8 +934,8 @@
147                 inode->i_size = l-1;
148         }
149         inode->u.ext3_i.i_disksize = inode->i_size;
150 -       ext3_mark_inode_dirty(handle, inode);
151         err = ext3_add_nondir(handle, dentry, inode);
152 +       ext3_mark_inode_dirty(handle, inode);
153  out_stop:
154         ext3_journal_stop(handle, dir);
155         return err;
156 @@ -970,8 +971,8 @@
157         ext3_inc_count(handle, inode);
158         atomic_inc(&inode->i_count);
159  
160 -       ext3_mark_inode_dirty(handle, inode);
161         err = ext3_add_nondir(handle, dentry, inode);
162 +       ext3_mark_inode_dirty(handle, inode);
163         ext3_journal_stop(handle, dir);
164         return err;
165  }