Whamcloud - gitweb
LU-3292 build: kernel update for 3.0.74-0.6.6 sles11sp2
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / sles11sp2 / ext4-use-ext4_msg-instead-of-printk-in-mballoc.patch
1 From 9d8b9ec44234b2f6e0225300632d250210c04f11 Mon Sep 17 00:00:00 2001
2 From: Theodore Ts'o <tytso@mit.edu>
3 Date: Mon, 1 Aug 2011 17:41:35 -0400
4 Subject: ext4: use ext4_msg() instead of printk in mballoc
5 Git-commit: 9d8b9ec4
6 Patch-mainline: v3.1-rc1
7
8 Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
9 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
10 ---
11  fs/ext4/mballoc.c |   79 ++++++++++++++++++++++++++++-------------------------
12  1 files changed, 42 insertions(+), 37 deletions(-)
13
14 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
15 index d5021e8..70d1b3e 100644
16 --- a/fs/ext4/mballoc.c
17 +++ b/fs/ext4/mballoc.c
18 @@ -493,10 +493,11 @@ static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap)
19                 b2 = (unsigned char *) bitmap;
20                 for (i = 0; i < e4b->bd_sb->s_blocksize; i++) {
21                         if (b1[i] != b2[i]) {
22 -                               printk(KERN_ERR "corruption in group %u "
23 -                                      "at byte %u(%u): %x in copy != %x "
24 -                                      "on disk/prealloc\n",
25 -                                      e4b->bd_group, i, i * 8, b1[i], b2[i]);
26 +                               ext4_msg(e4b->bd_sb, KERN_ERR,
27 +                                        "corruption in group %u "
28 +                                        "at byte %u(%u): %x in copy != %x "
29 +                                        "on disk/prealloc",
30 +                                        e4b->bd_group, i, i * 8, b1[i], b2[i]);
31                                 BUG();
32                         }
33                 }
34 @@ -2224,8 +2225,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
35                         EXT4_DESC_PER_BLOCK_BITS(sb);
36                 meta_group_info = kmalloc(metalen, GFP_KERNEL);
37                 if (meta_group_info == NULL) {
38 -                       printk(KERN_ERR "EXT4-fs: can't allocate mem for a "
39 -                              "buddy group\n");
40 +                       ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate mem "
41 +                                "for a buddy group");
42                         goto exit_meta_group_info;
43                 }
44                 sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] =
45 @@ -2238,7 +2239,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
46
47         meta_group_info[i] = kmem_cache_alloc(cachep, GFP_KERNEL);
48         if (meta_group_info[i] == NULL) {
49 -               printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n");
50 +               ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate buddy mem");
51                 goto exit_group_info;
52         }
53         memset(meta_group_info[i], 0, kmem_cache_size(cachep));
54 @@ -2333,12 +2334,12 @@ static int ext4_mb_init_backend(struct super_block *sb)
55          * So a two level scheme suffices for now. */
56         sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL);
57         if (sbi->s_group_info == NULL) {
58 -               printk(KERN_ERR "EXT4-fs: can't allocate buddy meta group\n");
59 +               ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
60                 return -ENOMEM;
61         }
62         sbi->s_buddy_cache = new_inode(sb);
63         if (sbi->s_buddy_cache == NULL) {
64 -               printk(KERN_ERR "EXT4-fs: can't get new inode\n");
65 +               ext4_msg(sb, KERN_ERR, "can't get new inode");
66                 goto err_freesgi;
67         }
68         sbi->s_buddy_cache->i_ino = get_next_ino();
69 @@ -2346,8 +2347,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
70         for (i = 0; i < ngroups; i++) {
71                 desc = ext4_get_group_desc(sb, i, NULL);
72                 if (desc == NULL) {
73 -                       printk(KERN_ERR
74 -                               "EXT4-fs: can't read descriptor %u\n", i);
75 +                       ext4_msg(sb, KERN_ERR, "can't read descriptor %u", i);
76                         goto err_freebuddy;
77                 }
78                 if (ext4_mb_add_groupinfo(sb, i, desc) != 0)
79 @@ -2411,7 +2411,8 @@ static int ext4_groupinfo_create_slab(size_t size)
80
81         mutex_unlock(&ext4_grpinfo_slab_create_mutex);
82         if (!cachep) {
83 -               printk(KERN_EMERG "EXT4: no memory for groupinfo slab cache\n");
84 +               printk(KERN_EMERG
85 +                      "EXT4-fs: no memory for groupinfo slab cache\n");
86                 return -ENOMEM;
87         }
88
89 @@ -2566,25 +2567,25 @@ int ext4_mb_release(struct super_block *sb)
90         if (sbi->s_buddy_cache)
91                 iput(sbi->s_buddy_cache);
92         if (sbi->s_mb_stats) {
93 -               printk(KERN_INFO
94 -                      "EXT4-fs: mballoc: %u blocks %u reqs (%u success)\n",
95 +               ext4_msg(sb, KERN_INFO,
96 +                      "mballoc: %u blocks %u reqs (%u success)",
97                                 atomic_read(&sbi->s_bal_allocated),
98                                 atomic_read(&sbi->s_bal_reqs),
99                                 atomic_read(&sbi->s_bal_success));
100 -               printk(KERN_INFO
101 -                     "EXT4-fs: mballoc: %u extents scanned, %u goal hits, "
102 -                               "%u 2^N hits, %u breaks, %u lost\n",
103 +               ext4_msg(sb, KERN_INFO,
104 +                     "mballoc: %u extents scanned, %u goal hits, "
105 +                               "%u 2^N hits, %u breaks, %u lost",
106                                 atomic_read(&sbi->s_bal_ex_scanned),
107                                 atomic_read(&sbi->s_bal_goals),
108                                 atomic_read(&sbi->s_bal_2orders),
109                                 atomic_read(&sbi->s_bal_breaks),
110                                 atomic_read(&sbi->s_mb_lost_chunks));
111 -               printk(KERN_INFO
112 -                      "EXT4-fs: mballoc: %lu generated and it took %Lu\n",
113 +               ext4_msg(sb, KERN_INFO,
114 +                      "mballoc: %lu generated and it took %Lu",
115                                 sbi->s_mb_buddies_generated++,
116                                 sbi->s_mb_generation_time);
117 -               printk(KERN_INFO
118 -                      "EXT4-fs: mballoc: %u preallocated, %u discarded\n",
119 +               ext4_msg(sb, KERN_INFO,
120 +                      "mballoc: %u preallocated, %u discarded",
121                                 atomic_read(&sbi->s_mb_preallocated),
122                                 atomic_read(&sbi->s_mb_discarded));
123         }
124 @@ -3024,9 +3025,10 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
125
126         if (start + size <= ac->ac_o_ex.fe_logical &&
127                         start > ac->ac_o_ex.fe_logical) {
128 -               printk(KERN_ERR "start %lu, size %lu, fe_logical %lu\n",
129 -                       (unsigned long) start, (unsigned long) size,
130 -                       (unsigned long) ac->ac_o_ex.fe_logical);
131 +               ext4_msg(ac->ac_sb, KERN_ERR,
132 +                        "start %lu, size %lu, fe_logical %lu",
133 +                        (unsigned long) start, (unsigned long) size,
134 +                        (unsigned long) ac->ac_o_ex.fe_logical);
135         }
136         BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
137                         start > ac->ac_o_ex.fe_logical);
138 @@ -3607,10 +3609,11 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
139                 bit = next + 1;
140         }
141         if (free != pa->pa_free) {
142 -               printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n",
143 -                       pa, (unsigned long) pa->pa_lstart,
144 -                       (unsigned long) pa->pa_pstart,
145 -                       (unsigned long) pa->pa_len);
146 +               ext4_msg(e4b->bd_sb, KERN_CRIT,
147 +                        "pa %p: logic %lu, phys. %lu, len %lu",
148 +                        pa, (unsigned long) pa->pa_lstart,
149 +                        (unsigned long) pa->pa_pstart,
150 +                        (unsigned long) pa->pa_len);
151                 ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u",
152                                         free, pa->pa_free);
153                 /*
154 @@ -3798,7 +3801,8 @@ repeat:
155                          * use preallocation while we're discarding it */
156                         spin_unlock(&pa->pa_lock);
157                         spin_unlock(&ei->i_prealloc_lock);
158 -                       printk(KERN_ERR "uh-oh! used pa while discarding\n");
159 +                       ext4_msg(sb, KERN_ERR,
160 +                                "uh-oh! used pa while discarding");
161                         WARN_ON(1);
162                         schedule_timeout_uninterruptible(HZ);
163                         goto repeat;
164 @@ -3875,12 +3879,13 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
165             (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED))
166                 return;
167
168 -       printk(KERN_ERR "EXT4-fs: Can't allocate:"
169 -                       " Allocation context details:\n");
170 -       printk(KERN_ERR "EXT4-fs: status %d flags %d\n",
171 +       ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: Can't allocate:"
172 +                       " Allocation context details:");
173 +       ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: status %d flags %d",
174                         ac->ac_status, ac->ac_flags);
175 -       printk(KERN_ERR "EXT4-fs: orig %lu/%lu/%lu@%lu, goal %lu/%lu/%lu@%lu, "
176 -                       "best %lu/%lu/%lu@%lu cr %d\n",
177 +       ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: orig %lu/%lu/%lu@%lu, "
178 +                       "goal %lu/%lu/%lu@%lu, "
179 +                       "best %lu/%lu/%lu@%lu cr %d",
180                         (unsigned long)ac->ac_o_ex.fe_group,
181                         (unsigned long)ac->ac_o_ex.fe_start,
182                         (unsigned long)ac->ac_o_ex.fe_len,
183 @@ -3894,9 +3899,9 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
184                         (unsigned long)ac->ac_b_ex.fe_len,
185                         (unsigned long)ac->ac_b_ex.fe_logical,
186                         (int)ac->ac_criteria);
187 -       printk(KERN_ERR "EXT4-fs: %lu scanned, %d found\n", ac->ac_ex_scanned,
188 -               ac->ac_found);
189 -       printk(KERN_ERR "EXT4-fs: groups: \n");
190 +       ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: %lu scanned, %d found",
191 +                ac->ac_ex_scanned, ac->ac_found);
192 +       ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: groups: ");
193         ngroups = ext4_get_groups_count(sb);
194         for (i = 0; i < ngroups; i++) {
195                 struct ext4_group_info *grp = ext4_get_group_info(sb, i);
196