]> git.pld-linux.org Git - packages/gfs2.git/blob - gfs2-quota-nolist.patch
- more notes
[packages/gfs2.git] / gfs2-quota-nolist.patch
1 --- cluster-2.03.10/gfs2/libgfs2/ondisk.c.orig  2008-12-09 09:36:04.000000000 +0100
2 +++ cluster-2.03.10/gfs2/libgfs2/ondisk.c       2011-05-23 18:13:36.813924684 +0200
3 @@ -217,8 +217,7 @@ void gfs2_quota_in(struct gfs2_quota *qu
4         CPIN_64(qu, str, qu_limit);
5         CPIN_64(qu, str, qu_warn);
6         CPIN_64(qu, str, qu_value);
7 -       CPIN_32(qu, str, qu_ll_next);
8 -       CPIN_08(qu, str, qu_reserved, 60);
9 +       CPIN_08(qu, str, qu_reserved, 64);
10  }
11  
12  void gfs2_quota_out(struct gfs2_quota *qu, char *buf)
13 @@ -228,8 +227,7 @@ void gfs2_quota_out(struct gfs2_quota *q
14         CPOUT_64(qu, str, qu_limit);
15         CPOUT_64(qu, str, qu_warn);
16         CPOUT_64(qu, str, qu_value);
17 -       CPOUT_32(qu, str, qu_ll_next);
18 -       CPOUT_08(qu, str, qu_reserved, 60);
19 +       CPOUT_08(qu, str, qu_reserved, 64);
20  }
21  
22  void gfs2_quota_print(struct gfs2_quota *qu)
23 --- cluster-2.03.10/gfs2/quota/main.c.orig      2008-12-09 09:36:04.000000000 +0100
24 +++ cluster-2.03.10/gfs2/quota/main.c   2011-05-27 23:17:21.726106878 +0200
25 @@ -374,106 +374,6 @@
26  }
27  
28  /**
29 - * is_valid_quota_list - Check if we have a valid quota list
30 - * @fd: an open file descriptor of the quota file
31 - * Returns 0 or 1.
32 - */
33 -int 
34 -is_valid_quota_list(int fd)
35 -{
36 -       /* This is a slow test to determine if the quotas are in a 
37 -        * linked list. We should come up with something better
38 -        * Quota linked list format is identified by the following.
39 -        * step1: Get the maximum groupid and userid having valid
40 -        *        quotas in the quota file.
41 -        * step2: Obtain the size of the quota file. The size of the 
42 -        *        quota file (position of the last valid quota) 
43 -        *        determines the last user/group id.
44 -        * step3: If we can obtain the last valid quota through the 
45 -        *        lists, then our lists are good. Else, the lists are 
46 -        *        either corrupt or an older quota file format is in use
47 -        */
48 -       int id_type = GQ_ID_GROUP;
49 -       uint32_t id = 0, prev, ulast = 0, glast = 0, max;
50 -       struct gfs2_quota q;
51 -
52 -       get_last_quota_id(fd, &max);
53 -again:
54 -       do {
55 -               read_quota_internal(fd, id, id_type, &q);
56 -               prev = id;
57 -               id = q.qu_ll_next;
58 -               if (id > max)
59 -                       return 0;
60 -       } while (id && id > prev);
61 -
62 -       if (id && id <= prev)
63 -               return 0;
64 -
65 -       if (id_type == GQ_ID_GROUP)
66 -               glast = prev;
67 -       else
68 -               ulast = prev;
69 -
70 -       if (id_type == GQ_ID_GROUP) {
71 -               id_type = GQ_ID_USER;
72 -               id = 0;
73 -               goto again;
74 -       }
75 -
76 -       if (glast != max && ulast != max)
77 -               return 0;
78 -       
79 -       return 1;
80 -}
81 -
82 -void 
83 -print_quota_list_warning()
84 -{
85 -       printf("\nWarning: This filesystem doesn't seem to have the new quota "
86 -              "list format or the quota list is corrupt. list, check and init "
87 -              "operation performance will suffer due to this. It is recommended "
88 -              "that you run the 'gfs2_quota reset' operation to reset the quota "
89 -              "file. All current quota information will be lost and you will "
90 -              "have to reassign all quota limits and warnings\n\n"); 
91 -}
92 -
93 -/**
94 - * adjust_quota_list - Adjust the quota linked list
95 - * @fd: The quota file descriptor
96 - * @comline: the struct containing the parsed command line arguments
97 - */
98 -static void
99 -adjust_quota_list(int fd, commandline_t *comline)
100 -{
101 -       uint32_t prev = 0, next = 0, id = comline->id;
102 -       struct gfs2_quota tmpq, q;
103 -       int id_type = comline->id_type;
104 -       
105 -       if (id == 0) /* root quota, don't do anything */
106 -               goto out;
107 -       /* We just wrote the quota for id in do_set(). Get it */
108 -       next = 0;
109 -       do {
110 -               read_quota_internal(fd, next, id_type, &q);
111 -               prev = next;
112 -               next = q.qu_ll_next;
113 -               if (prev == id) /* no duplicates, bail */
114 -                       goto out;
115 -               if (prev < id && id < next) /* gotcha! */
116 -                       break;
117 -       } while(next && next > prev);
118 -       read_quota_internal(fd, id, id_type, &tmpq);
119 -       tmpq.qu_ll_next = next;
120 -       q.qu_ll_next = id;
121 -       write_quota_internal(fd, id, id_type, &tmpq);
122 -       write_quota_internal(fd, prev, id_type, &q);
123 -
124 -out:
125 -       return;
126 -}
127 -
128 -/**
129   * do_reset - Reset all the quota data for a filesystem
130   * @comline: the struct containing the parsed command line arguments
131   */
132 @@ -512,11 +412,9 @@
133         }
134  
135         read_quota_internal(fd, 0, GQ_ID_USER, &q);
136 -       q.qu_ll_next = 0;
137         write_quota_internal(fd, 0, GQ_ID_USER, &q);
138  
139         read_quota_internal(fd, 0, GQ_ID_GROUP, &q);
140 -       q.qu_ll_next = 0;
141         write_quota_internal(fd, 0, GQ_ID_GROUP, &q);
142  
143         /* truncate the quota file such that only the first
144 @@ -568,29 +466,6 @@
145                     strerror(errno));
146         }
147         
148 -       if (!is_valid_quota_list(fd)) {
149 -               print_quota_list_warning();
150 -               goto do_old_school;
151 -       }
152 -       get_last_quota_id(fd, &maxid);
153 -       
154 -       for (pass=0; pass<2; pass++) {
155 -               id = 0;
156 -               id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
157 -               
158 -               do {
159 -                       read_quota_internal(fd, id, id_type, &q);
160 -                       prev = id;
161 -                       if (q.qu_limit || q.qu_warn || q.qu_value)
162 -                               print_quota(comline, 
163 -                                           id_type == GQ_ID_USER ? TRUE : FALSE, 
164 -                                           id, &q, &sdp->sd_sb);
165 -                       id = q.qu_ll_next;
166 -               } while(id && id > prev && id <= maxid);
167 -       }
168 -       goto out;
169 -
170 -do_old_school:
171         for (pass=0; pass<2; pass++) {
172                 if (!pass)
173                         offset = 0;
174 @@ -615,7 +490,6 @@
175                         offset += 2 * sizeof(struct gfs2_quota);
176                 } while (error == sizeof(struct gfs2_quota));
177         }
178 -out:
179         close(fd);
180         close(sdp->metafs_fd);
181         cleanup_metafs(sdp);
182 @@ -789,7 +663,7 @@
183         int fd;
184         uint64_t offset;
185         uint64_t new_value;
186 -       int error, adj_flag = 0;;
187 +       int error;
188         char quota_file[BUF_SIZE];
189         char id_str[16];
190         struct stat stat_buf;
191 @@ -816,11 +690,6 @@
192                     strerror(errno));
193         }
194         
195 -       if (is_valid_quota_list(fd))
196 -               adj_flag = 1;
197 -       else
198 -               print_quota_list_warning();
199 -
200         switch (comline->id_type) {
201         case GQ_ID_USER:
202                 offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs2_quota);
203 @@ -938,8 +807,6 @@
204         set_sysfs(fs, comline->id_type == GQ_ID_USER ?
205                   "quota_refresh_user" : "quota_refresh_group", id_str);
206         
207 -       if (adj_flag)
208 -               adjust_quota_list(fd, comline);
209  out:
210         close(fd);
211         close(sdp->metafs_fd);
212 --- cluster-2.03.10/gfs2/quota/check.c.orig     2008-12-09 09:36:04.000000000 +0100
213 +++ cluster-2.03.10/gfs2/quota/check.c  2011-05-27 23:16:22.309438221 +0200
214 @@ -194,33 +194,6 @@
215                     strerror(errno));
216         }
217  
218 -       if (!is_valid_quota_list(fd)) {
219 -               print_quota_list_warning();
220 -               goto do_old_school;
221 -       }
222 -       get_last_quota_id(fd, &maxid);
223 -       
224 -       for (pass=0; pass<2; pass++) {
225 -               id = 0;
226 -               id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
227 -               
228 -               do {
229 -                       read_quota_internal(fd, id, id_type, &q);
230 -                       prev = id;
231 -                       q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
232 -                       
233 -                       if (q.qu_value) {
234 -                               if (pass)
235 -                                       add_value(gid, id, q.qu_value);
236 -                               else
237 -                                       add_value(uid, id, q.qu_value);
238 -                       }
239 -                       id = q.qu_ll_next;
240 -               } while(id && id > prev && id <= maxid);
241 -       }
242 -       goto out;
243 -       
244 -do_old_school:
245         do {
246                 
247                 memset(buf, 0, sizeof(struct gfs2_quota));
248 @@ -249,7 +222,6 @@
249                 offset += sizeof(struct gfs2_quota);
250         } while (error == sizeof(struct gfs2_quota));
251  
252 -out:
253         close(fd);
254         close(sdp->metafs_fd);
255         cleanup_metafs(sdp);
This page took 0.102134 seconds and 3 git commands to generate.