]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: reiserfs: rename p_s_inode to inode | |
3 | ||
4 | This patch is a simple s/p_s_inode/inode/g to the reiserfs code. This is the | |
5 | third in a series of patches to rip out some of the awful variable naming in | |
6 | reiserfs. | |
7 | ||
8 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
9 | ||
10 | --- | |
11 | ||
12 | fs/reiserfs/file.c | 16 +++--- | |
13 | fs/reiserfs/inode.c | 43 ++++++++--------- | |
14 | fs/reiserfs/stree.c | 103 +++++++++++++++++++++--------------------- | |
15 | fs/reiserfs/tail_conversion.c | 18 ++++--- | |
16 | include/linux/reiserfs_fs.h | 4 - | |
17 | 5 files changed, 95 insertions(+), 89 deletions(-) | |
18 | ||
19 | --- a/fs/reiserfs/file.c | |
20 | +++ b/fs/reiserfs/file.c | |
21 | @@ -137,17 +137,17 @@ static void reiserfs_vfs_truncate_file(s | |
22 | static int reiserfs_sync_file(struct file *p_s_filp, | |
23 | struct dentry *p_s_dentry, int datasync) | |
24 | { | |
25 | - struct inode *p_s_inode = p_s_dentry->d_inode; | |
26 | + struct inode *inode = p_s_dentry->d_inode; | |
27 | int n_err; | |
28 | int barrier_done; | |
29 | ||
30 | - BUG_ON(!S_ISREG(p_s_inode->i_mode)); | |
31 | - n_err = sync_mapping_buffers(p_s_inode->i_mapping); | |
32 | - reiserfs_write_lock(p_s_inode->i_sb); | |
33 | - barrier_done = reiserfs_commit_for_inode(p_s_inode); | |
34 | - reiserfs_write_unlock(p_s_inode->i_sb); | |
35 | - if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb)) | |
36 | - blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL); | |
37 | + BUG_ON(!S_ISREG(inode->i_mode)); | |
38 | + n_err = sync_mapping_buffers(inode->i_mapping); | |
39 | + reiserfs_write_lock(inode->i_sb); | |
40 | + barrier_done = reiserfs_commit_for_inode(inode); | |
41 | + reiserfs_write_unlock(inode->i_sb); | |
42 | + if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) | |
43 | + blkdev_issue_flush(inode->i_sb->s_bdev, NULL); | |
44 | if (barrier_done < 0) | |
45 | return barrier_done; | |
46 | return (n_err < 0) ? -EIO : 0; | |
47 | --- a/fs/reiserfs/inode.c | |
48 | +++ b/fs/reiserfs/inode.c | |
49 | @@ -1992,7 +1992,7 @@ int reiserfs_new_inode(struct reiserfs_t | |
50 | ** | |
51 | ** on failure, nonzero is returned, page_result and bh_result are untouched. | |
52 | */ | |
53 | -static int grab_tail_page(struct inode *p_s_inode, | |
54 | +static int grab_tail_page(struct inode *inode, | |
55 | struct page **page_result, | |
56 | struct buffer_head **bh_result) | |
57 | { | |
58 | @@ -2000,11 +2000,11 @@ static int grab_tail_page(struct inode * | |
59 | /* we want the page with the last byte in the file, | |
60 | ** not the page that will hold the next byte for appending | |
61 | */ | |
62 | - unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT; | |
63 | + unsigned long index = (inode->i_size - 1) >> PAGE_CACHE_SHIFT; | |
64 | unsigned long pos = 0; | |
65 | unsigned long start = 0; | |
66 | - unsigned long blocksize = p_s_inode->i_sb->s_blocksize; | |
67 | - unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1); | |
68 | + unsigned long blocksize = inode->i_sb->s_blocksize; | |
69 | + unsigned long offset = (inode->i_size) & (PAGE_CACHE_SIZE - 1); | |
70 | struct buffer_head *bh; | |
71 | struct buffer_head *head; | |
72 | struct page *page; | |
73 | @@ -2018,7 +2018,7 @@ static int grab_tail_page(struct inode * | |
74 | if ((offset & (blocksize - 1)) == 0) { | |
75 | return -ENOENT; | |
76 | } | |
77 | - page = grab_cache_page(p_s_inode->i_mapping, index); | |
78 | + page = grab_cache_page(inode->i_mapping, index); | |
79 | error = -ENOMEM; | |
80 | if (!page) { | |
81 | goto out; | |
82 | @@ -2047,7 +2047,7 @@ static int grab_tail_page(struct inode * | |
83 | ** I've screwed up the code to find the buffer, or the code to | |
84 | ** call prepare_write | |
85 | */ | |
86 | - reiserfs_error(p_s_inode->i_sb, "clm-6000", | |
87 | + reiserfs_error(inode->i_sb, "clm-6000", | |
88 | "error reading block %lu", bh->b_blocknr); | |
89 | error = -EIO; | |
90 | goto unlock; | |
91 | @@ -2070,27 +2070,28 @@ static int grab_tail_page(struct inode * | |
92 | ** | |
93 | ** some code taken from block_truncate_page | |
94 | */ | |
95 | -int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) | |
96 | +int reiserfs_truncate_file(struct inode *inode, int update_timestamps) | |
97 | { | |
98 | struct reiserfs_transaction_handle th; | |
99 | /* we want the offset for the first byte after the end of the file */ | |
100 | - unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1); | |
101 | - unsigned blocksize = p_s_inode->i_sb->s_blocksize; | |
102 | + unsigned long offset = inode->i_size & (PAGE_CACHE_SIZE - 1); | |
103 | + unsigned blocksize = inode->i_sb->s_blocksize; | |
104 | unsigned length; | |
105 | struct page *page = NULL; | |
106 | int error; | |
107 | struct buffer_head *bh = NULL; | |
108 | int err2; | |
109 | ||
110 | - reiserfs_write_lock(p_s_inode->i_sb); | |
111 | + reiserfs_write_lock(inode->i_sb); | |
112 | ||
113 | - if (p_s_inode->i_size > 0) { | |
114 | - if ((error = grab_tail_page(p_s_inode, &page, &bh))) { | |
115 | + if (inode->i_size > 0) { | |
116 | + error = grab_tail_page(inode, &page, &bh); | |
117 | + if (error) { | |
118 | // -ENOENT means we truncated past the end of the file, | |
119 | // and get_block_create_0 could not find a block to read in, | |
120 | // which is ok. | |
121 | if (error != -ENOENT) | |
122 | - reiserfs_error(p_s_inode->i_sb, "clm-6001", | |
123 | + reiserfs_error(inode->i_sb, "clm-6001", | |
124 | "grab_tail_page failed %d", | |
125 | error); | |
126 | page = NULL; | |
127 | @@ -2108,19 +2109,19 @@ int reiserfs_truncate_file(struct inode | |
128 | /* it is enough to reserve space in transaction for 2 balancings: | |
129 | one for "save" link adding and another for the first | |
130 | cut_from_item. 1 is for update_sd */ | |
131 | - error = journal_begin(&th, p_s_inode->i_sb, | |
132 | + error = journal_begin(&th, inode->i_sb, | |
133 | JOURNAL_PER_BALANCE_CNT * 2 + 1); | |
134 | if (error) | |
135 | goto out; | |
136 | - reiserfs_update_inode_transaction(p_s_inode); | |
137 | + reiserfs_update_inode_transaction(inode); | |
138 | if (update_timestamps) | |
139 | /* we are doing real truncate: if the system crashes before the last | |
140 | transaction of truncating gets committed - on reboot the file | |
141 | either appears truncated properly or not truncated at all */ | |
142 | - add_save_link(&th, p_s_inode, 1); | |
143 | - err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); | |
144 | + add_save_link(&th, inode, 1); | |
145 | + err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps); | |
146 | error = | |
147 | - journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); | |
148 | + journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); | |
149 | if (error) | |
150 | goto out; | |
151 | ||
152 | @@ -2131,7 +2132,7 @@ int reiserfs_truncate_file(struct inode | |
153 | } | |
154 | ||
155 | if (update_timestamps) { | |
156 | - error = remove_save_link(p_s_inode, 1 /* truncate */ ); | |
157 | + error = remove_save_link(inode, 1 /* truncate */); | |
158 | if (error) | |
159 | goto out; | |
160 | } | |
161 | @@ -2150,14 +2151,14 @@ int reiserfs_truncate_file(struct inode | |
162 | page_cache_release(page); | |
163 | } | |
164 | ||
165 | - reiserfs_write_unlock(p_s_inode->i_sb); | |
166 | + reiserfs_write_unlock(inode->i_sb); | |
167 | return 0; | |
168 | out: | |
169 | if (page) { | |
170 | unlock_page(page); | |
171 | page_cache_release(page); | |
172 | } | |
173 | - reiserfs_write_unlock(p_s_inode->i_sb); | |
174 | + reiserfs_write_unlock(inode->i_sb); | |
175 | return error; | |
176 | } | |
177 | ||
178 | --- a/fs/reiserfs/stree.c | |
179 | +++ b/fs/reiserfs/stree.c | |
180 | @@ -1143,10 +1143,11 @@ char head2type(struct item_head *ih) | |
181 | /* Delete object item. */ | |
182 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, struct treepath *p_s_path, /* Path to the deleted item. */ | |
183 | const struct cpu_key *p_s_item_key, /* Key to search for the deleted item. */ | |
184 | - struct inode *p_s_inode, /* inode is here just to update i_blocks and quotas */ | |
185 | + struct inode *inode, /* inode is here just to update | |
186 | + * i_blocks and quotas */ | |
187 | struct buffer_head *p_s_un_bh) | |
188 | { /* NULL or unformatted node pointer. */ | |
189 | - struct super_block *sb = p_s_inode->i_sb; | |
190 | + struct super_block *sb = inode->i_sb; | |
191 | struct tree_balance s_del_balance; | |
192 | struct item_head s_ih; | |
193 | struct item_head *q_ih; | |
194 | @@ -1170,10 +1171,10 @@ int reiserfs_delete_item(struct reiserfs | |
195 | n_iter++; | |
196 | c_mode = | |
197 | #endif | |
198 | - prepare_for_delete_or_cut(th, p_s_inode, p_s_path, | |
199 | + prepare_for_delete_or_cut(th, inode, p_s_path, | |
200 | p_s_item_key, &n_removed, | |
201 | &n_del_size, | |
202 | - max_reiserfs_offset(p_s_inode)); | |
203 | + max_reiserfs_offset(inode)); | |
204 | ||
205 | RFALSE(c_mode != M_DELETE, "PAP-5320: mode must be M_DELETE"); | |
206 | ||
207 | @@ -1214,7 +1215,7 @@ int reiserfs_delete_item(struct reiserfs | |
208 | ** split into multiple items, and we only want to decrement for | |
209 | ** the unfm node once | |
210 | */ | |
211 | - if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(q_ih)) { | |
212 | + if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(q_ih)) { | |
213 | if ((le_ih_k_offset(q_ih) & (sb->s_blocksize - 1)) == 1) { | |
214 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; | |
215 | } else { | |
216 | @@ -1259,9 +1260,9 @@ int reiserfs_delete_item(struct reiserfs | |
217 | #ifdef REISERQUOTA_DEBUG | |
218 | reiserfs_debug(sb, REISERFS_DEBUG_CODE, | |
219 | "reiserquota delete_item(): freeing %u, id=%u type=%c", | |
220 | - quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih)); | |
221 | + quota_cut_bytes, inode->i_uid, head2type(&s_ih)); | |
222 | #endif | |
223 | - DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes); | |
224 | + DQUOT_FREE_SPACE_NODIRTY(inode, quota_cut_bytes); | |
225 | ||
226 | /* Return deleted body length */ | |
227 | return n_ret_value; | |
228 | @@ -1423,25 +1424,25 @@ static void unmap_buffers(struct page *p | |
229 | } | |
230 | ||
231 | static int maybe_indirect_to_direct(struct reiserfs_transaction_handle *th, | |
232 | - struct inode *p_s_inode, | |
233 | + struct inode *inode, | |
234 | struct page *page, | |
235 | struct treepath *p_s_path, | |
236 | const struct cpu_key *p_s_item_key, | |
237 | loff_t n_new_file_size, char *p_c_mode) | |
238 | { | |
239 | - struct super_block *sb = p_s_inode->i_sb; | |
240 | + struct super_block *sb = inode->i_sb; | |
241 | int n_block_size = sb->s_blocksize; | |
242 | int cut_bytes; | |
243 | BUG_ON(!th->t_trans_id); | |
244 | - BUG_ON(n_new_file_size != p_s_inode->i_size); | |
245 | + BUG_ON(n_new_file_size != inode->i_size); | |
246 | ||
247 | /* the page being sent in could be NULL if there was an i/o error | |
248 | ** reading in the last block. The user will hit problems trying to | |
249 | ** read the file, but for now we just skip the indirect2direct | |
250 | */ | |
251 | - if (atomic_read(&p_s_inode->i_count) > 1 || | |
252 | - !tail_has_to_be_packed(p_s_inode) || | |
253 | - !page || (REISERFS_I(p_s_inode)->i_flags & i_nopack_mask)) { | |
254 | + if (atomic_read(&inode->i_count) > 1 || | |
255 | + !tail_has_to_be_packed(inode) || | |
256 | + !page || (REISERFS_I(inode)->i_flags & i_nopack_mask)) { | |
257 | /* leave tail in an unformatted node */ | |
258 | *p_c_mode = M_SKIP_BALANCING; | |
259 | cut_bytes = | |
260 | @@ -1450,8 +1451,9 @@ static int maybe_indirect_to_direct(stru | |
261 | return cut_bytes; | |
262 | } | |
263 | /* Permorm the conversion to a direct_item. */ | |
264 | - /*return indirect_to_direct (p_s_inode, p_s_path, p_s_item_key, n_new_file_size, p_c_mode); */ | |
265 | - return indirect2direct(th, p_s_inode, page, p_s_path, p_s_item_key, | |
266 | + /* return indirect_to_direct(inode, p_s_path, p_s_item_key, | |
267 | + n_new_file_size, p_c_mode); */ | |
268 | + return indirect2direct(th, inode, page, p_s_path, p_s_item_key, | |
269 | n_new_file_size, p_c_mode); | |
270 | } | |
271 | ||
272 | @@ -1505,10 +1507,10 @@ static void indirect_to_direct_roll_back | |
273 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |
274 | struct treepath *p_s_path, | |
275 | struct cpu_key *p_s_item_key, | |
276 | - struct inode *p_s_inode, | |
277 | + struct inode *inode, | |
278 | struct page *page, loff_t n_new_file_size) | |
279 | { | |
280 | - struct super_block *sb = p_s_inode->i_sb; | |
281 | + struct super_block *sb = inode->i_sb; | |
282 | /* Every function which is going to call do_balance must first | |
283 | create a tree_balance structure. Then it must fill up this | |
284 | structure by using the init_tb_struct and fix_nodes functions. | |
285 | @@ -1525,7 +1527,7 @@ int reiserfs_cut_from_item(struct reiser | |
286 | ||
287 | BUG_ON(!th->t_trans_id); | |
288 | ||
289 | - init_tb_struct(th, &s_cut_balance, p_s_inode->i_sb, p_s_path, | |
290 | + init_tb_struct(th, &s_cut_balance, inode->i_sb, p_s_path, | |
291 | n_cut_size); | |
292 | ||
293 | /* Repeat this loop until we either cut the item without needing | |
294 | @@ -1537,7 +1539,7 @@ int reiserfs_cut_from_item(struct reiser | |
295 | pointers. */ | |
296 | ||
297 | c_mode = | |
298 | - prepare_for_delete_or_cut(th, p_s_inode, p_s_path, | |
299 | + prepare_for_delete_or_cut(th, inode, p_s_path, | |
300 | p_s_item_key, &n_removed, | |
301 | &n_cut_size, n_new_file_size); | |
302 | if (c_mode == M_CONVERT) { | |
303 | @@ -1547,7 +1549,7 @@ int reiserfs_cut_from_item(struct reiser | |
304 | "PAP-5570: can not convert twice"); | |
305 | ||
306 | n_ret_value = | |
307 | - maybe_indirect_to_direct(th, p_s_inode, page, | |
308 | + maybe_indirect_to_direct(th, inode, page, | |
309 | p_s_path, p_s_item_key, | |
310 | n_new_file_size, &c_mode); | |
311 | if (c_mode == M_SKIP_BALANCING) | |
312 | @@ -1612,7 +1614,7 @@ int reiserfs_cut_from_item(struct reiser | |
313 | if (n_is_inode_locked) { | |
314 | // FIXME: this seems to be not needed: we are always able | |
315 | // to cut item | |
316 | - indirect_to_direct_roll_back(th, p_s_inode, p_s_path); | |
317 | + indirect_to_direct_roll_back(th, inode, p_s_path); | |
318 | } | |
319 | if (n_ret_value == NO_DISK_SPACE) | |
320 | reiserfs_warning(sb, "reiserfs-5092", | |
321 | @@ -1639,12 +1641,12 @@ int reiserfs_cut_from_item(struct reiser | |
322 | ** item. | |
323 | */ | |
324 | p_le_ih = PATH_PITEM_HEAD(s_cut_balance.tb_path); | |
325 | - if (!S_ISLNK(p_s_inode->i_mode) && is_direct_le_ih(p_le_ih)) { | |
326 | + if (!S_ISLNK(inode->i_mode) && is_direct_le_ih(p_le_ih)) { | |
327 | if (c_mode == M_DELETE && | |
328 | (le_ih_k_offset(p_le_ih) & (sb->s_blocksize - 1)) == | |
329 | 1) { | |
330 | // FIXME: this is to keep 3.5 happy | |
331 | - REISERFS_I(p_s_inode)->i_first_direct_byte = U32_MAX; | |
332 | + REISERFS_I(inode)->i_first_direct_byte = U32_MAX; | |
333 | quota_cut_bytes = sb->s_blocksize + UNFM_P_SIZE; | |
334 | } else { | |
335 | quota_cut_bytes = 0; | |
336 | @@ -1687,14 +1689,14 @@ int reiserfs_cut_from_item(struct reiser | |
337 | ** unmap and invalidate it | |
338 | */ | |
339 | unmap_buffers(page, tail_pos); | |
340 | - REISERFS_I(p_s_inode)->i_flags &= ~i_pack_on_close_mask; | |
341 | + REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; | |
342 | } | |
343 | #ifdef REISERQUOTA_DEBUG | |
344 | - reiserfs_debug(p_s_inode->i_sb, REISERFS_DEBUG_CODE, | |
345 | + reiserfs_debug(inode->i_sb, REISERFS_DEBUG_CODE, | |
346 | "reiserquota cut_from_item(): freeing %u id=%u type=%c", | |
347 | - quota_cut_bytes, p_s_inode->i_uid, '?'); | |
348 | + quota_cut_bytes, inode->i_uid, '?'); | |
349 | #endif | |
350 | - DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes); | |
351 | + DQUOT_FREE_SPACE_NODIRTY(inode, quota_cut_bytes); | |
352 | return n_ret_value; | |
353 | } | |
354 | ||
355 | @@ -1715,8 +1717,8 @@ static void truncate_directory(struct re | |
356 | ||
357 | /* Truncate file to the new size. Note, this must be called with a transaction | |
358 | already started */ | |
359 | -int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, /* ->i_size contains new | |
360 | - size */ | |
361 | +int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | |
362 | + struct inode *inode, /* ->i_size contains new size */ | |
363 | struct page *page, /* up to date for last block */ | |
364 | int update_timestamps /* when it is called by | |
365 | file_release to convert | |
366 | @@ -1735,35 +1737,35 @@ int reiserfs_do_truncate(struct reiserfs | |
367 | ||
368 | BUG_ON(!th->t_trans_id); | |
369 | if (! | |
370 | - (S_ISREG(p_s_inode->i_mode) || S_ISDIR(p_s_inode->i_mode) | |
371 | - || S_ISLNK(p_s_inode->i_mode))) | |
372 | + (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) | |
373 | + || S_ISLNK(inode->i_mode))) | |
374 | return 0; | |
375 | ||
376 | - if (S_ISDIR(p_s_inode->i_mode)) { | |
377 | + if (S_ISDIR(inode->i_mode)) { | |
378 | // deletion of directory - no need to update timestamps | |
379 | - truncate_directory(th, p_s_inode); | |
380 | + truncate_directory(th, inode); | |
381 | return 0; | |
382 | } | |
383 | ||
384 | /* Get new file size. */ | |
385 | - n_new_file_size = p_s_inode->i_size; | |
386 | + n_new_file_size = inode->i_size; | |
387 | ||
388 | // FIXME: note, that key type is unimportant here | |
389 | - make_cpu_key(&s_item_key, p_s_inode, max_reiserfs_offset(p_s_inode), | |
390 | + make_cpu_key(&s_item_key, inode, max_reiserfs_offset(inode), | |
391 | TYPE_DIRECT, 3); | |
392 | ||
393 | retval = | |
394 | - search_for_position_by_key(p_s_inode->i_sb, &s_item_key, | |
395 | + search_for_position_by_key(inode->i_sb, &s_item_key, | |
396 | &s_search_path); | |
397 | if (retval == IO_ERROR) { | |
398 | - reiserfs_error(p_s_inode->i_sb, "vs-5657", | |
399 | + reiserfs_error(inode->i_sb, "vs-5657", | |
400 | "i/o failure occurred trying to truncate %K", | |
401 | &s_item_key); | |
402 | err = -EIO; | |
403 | goto out; | |
404 | } | |
405 | if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) { | |
406 | - reiserfs_error(p_s_inode->i_sb, "PAP-5660", | |
407 | + reiserfs_error(inode->i_sb, "PAP-5660", | |
408 | "wrong result %d of search for %K", retval, | |
409 | &s_item_key); | |
410 | ||
411 | @@ -1780,7 +1782,7 @@ int reiserfs_do_truncate(struct reiserfs | |
412 | else { | |
413 | loff_t offset = le_ih_k_offset(p_le_ih); | |
414 | int bytes = | |
415 | - op_bytes_number(p_le_ih, p_s_inode->i_sb->s_blocksize); | |
416 | + op_bytes_number(p_le_ih, inode->i_sb->s_blocksize); | |
417 | ||
418 | /* this may mismatch with real file size: if last direct item | |
419 | had no padding zeros and last unformatted node had no free | |
420 | @@ -1805,9 +1807,9 @@ int reiserfs_do_truncate(struct reiserfs | |
421 | /* Cut or delete file item. */ | |
422 | n_deleted = | |
423 | reiserfs_cut_from_item(th, &s_search_path, &s_item_key, | |
424 | - p_s_inode, page, n_new_file_size); | |
425 | + inode, page, n_new_file_size); | |
426 | if (n_deleted < 0) { | |
427 | - reiserfs_warning(p_s_inode->i_sb, "vs-5665", | |
428 | + reiserfs_warning(inode->i_sb, "vs-5665", | |
429 | "reiserfs_cut_from_item failed"); | |
430 | reiserfs_check_path(&s_search_path); | |
431 | return 0; | |
432 | @@ -1837,22 +1839,22 @@ int reiserfs_do_truncate(struct reiserfs | |
433 | pathrelse(&s_search_path); | |
434 | ||
435 | if (update_timestamps) { | |
436 | - p_s_inode->i_mtime = p_s_inode->i_ctime = | |
437 | - CURRENT_TIME_SEC; | |
438 | + inode->i_mtime = CURRENT_TIME_SEC; | |
439 | + inode->i_ctime = CURRENT_TIME_SEC; | |
440 | } | |
441 | - reiserfs_update_sd(th, p_s_inode); | |
442 | + reiserfs_update_sd(th, inode); | |
443 | ||
444 | - err = journal_end(th, p_s_inode->i_sb, orig_len_alloc); | |
445 | + err = journal_end(th, inode->i_sb, orig_len_alloc); | |
446 | if (err) | |
447 | goto out; | |
448 | - err = journal_begin(th, p_s_inode->i_sb, | |
449 | + err = journal_begin(th, inode->i_sb, | |
450 | JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ; | |
451 | if (err) | |
452 | goto out; | |
453 | - reiserfs_update_inode_transaction(p_s_inode); | |
454 | + reiserfs_update_inode_transaction(inode); | |
455 | } | |
456 | } while (n_file_size > ROUND_UP(n_new_file_size) && | |
457 | - search_for_position_by_key(p_s_inode->i_sb, &s_item_key, | |
458 | + search_for_position_by_key(inode->i_sb, &s_item_key, | |
459 | &s_search_path) == POSITION_FOUND); | |
460 | ||
461 | RFALSE(n_file_size > ROUND_UP(n_new_file_size), | |
462 | @@ -1862,9 +1864,10 @@ int reiserfs_do_truncate(struct reiserfs | |
463 | update_and_out: | |
464 | if (update_timestamps) { | |
465 | // this is truncate, not file closing | |
466 | - p_s_inode->i_mtime = p_s_inode->i_ctime = CURRENT_TIME_SEC; | |
467 | + inode->i_mtime = CURRENT_TIME_SEC; | |
468 | + inode->i_ctime = CURRENT_TIME_SEC; | |
469 | } | |
470 | - reiserfs_update_sd(th, p_s_inode); | |
471 | + reiserfs_update_sd(th, inode); | |
472 | ||
473 | out: | |
474 | pathrelse(&s_search_path); | |
475 | --- a/fs/reiserfs/tail_conversion.c | |
476 | +++ b/fs/reiserfs/tail_conversion.c | |
477 | @@ -170,12 +170,14 @@ void reiserfs_unmap_buffer(struct buffer | |
478 | what we expect from it (number of cut bytes). But when tail remains | |
479 | in the unformatted node, we set mode to SKIP_BALANCING and unlock | |
480 | inode */ | |
481 | -int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */ | |
482 | +int indirect2direct(struct reiserfs_transaction_handle *th, | |
483 | + struct inode *inode, struct page *page, | |
484 | + struct treepath *p_s_path, /* path to the indirect item. */ | |
485 | const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ | |
486 | loff_t n_new_file_size, /* New file size. */ | |
487 | char *p_c_mode) | |
488 | { | |
489 | - struct super_block *sb = p_s_inode->i_sb; | |
490 | + struct super_block *sb = inode->i_sb; | |
491 | struct item_head s_ih; | |
492 | unsigned long n_block_size = sb->s_blocksize; | |
493 | char *tail; | |
494 | @@ -193,7 +195,7 @@ int indirect2direct(struct reiserfs_tran | |
495 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | |
496 | ||
497 | tail_len = (n_new_file_size & (n_block_size - 1)); | |
498 | - if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2) | |
499 | + if (get_inode_sd_version(inode) == STAT_DATA_V2) | |
500 | round_tail_len = ROUND_UP(tail_len); | |
501 | else | |
502 | round_tail_len = tail_len; | |
503 | @@ -228,7 +230,7 @@ int indirect2direct(struct reiserfs_tran | |
504 | } | |
505 | ||
506 | /* Set direct item header to insert. */ | |
507 | - make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode), | |
508 | + make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode), | |
509 | pos1 + 1, TYPE_DIRECT, round_tail_len, | |
510 | 0xffff /*ih_free_space */ ); | |
511 | ||
512 | @@ -244,7 +246,7 @@ int indirect2direct(struct reiserfs_tran | |
513 | set_cpu_key_k_type(&key, TYPE_DIRECT); | |
514 | key.key_length = 4; | |
515 | /* Insert tail as new direct item in the tree */ | |
516 | - if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode, | |
517 | + if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode, | |
518 | tail ? tail : NULL) < 0) { | |
519 | /* No disk memory. So we can not convert last unformatted node | |
520 | to the direct item. In this case we used to adjust | |
521 | @@ -258,7 +260,7 @@ int indirect2direct(struct reiserfs_tran | |
522 | kunmap(page); | |
523 | ||
524 | /* make sure to get the i_blocks changes from reiserfs_insert_item */ | |
525 | - reiserfs_update_sd(th, p_s_inode); | |
526 | + reiserfs_update_sd(th, inode); | |
527 | ||
528 | // note: we have now the same as in above direct2indirect | |
529 | // conversion: there are two keys which have matching first three | |
530 | @@ -269,8 +271,8 @@ int indirect2direct(struct reiserfs_tran | |
531 | *p_c_mode = M_CUT; | |
532 | ||
533 | /* we store position of first direct item in the in-core inode */ | |
534 | - //mark_file_with_tail (p_s_inode, pos1 + 1); | |
535 | - REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1; | |
536 | + /* mark_file_with_tail (inode, pos1 + 1); */ | |
537 | + REISERFS_I(inode)->i_first_direct_byte = pos1 + 1; | |
538 | ||
539 | return n_block_size - round_tail_len; | |
540 | } | |
541 | --- a/include/linux/reiserfs_fs.h | |
542 | +++ b/include/linux/reiserfs_fs.h | |
543 | @@ -1870,9 +1870,9 @@ int reiserfs_delete_item(struct reiserfs | |
544 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | |
545 | struct inode *inode, struct reiserfs_key *key); | |
546 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | |
547 | - struct inode *p_s_inode); | |
548 | + struct inode *inode); | |
549 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | |
550 | - struct inode *p_s_inode, struct page *, | |
551 | + struct inode *inode, struct page *, | |
552 | int update_timestamps); | |
553 | ||
554 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) |