aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/tail_conversion.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/tail_conversion.c')
-rw-r--r--fs/reiserfs/tail_conversion.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index 5c5ee0d0d6a8..2b90c0e5697c 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -172,10 +172,12 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
172 inode */ 172 inode */
173int indirect2direct(struct reiserfs_transaction_handle *th, 173int indirect2direct(struct reiserfs_transaction_handle *th,
174 struct inode *inode, struct page *page, 174 struct inode *inode, struct page *page,
175 struct treepath *p_s_path, /* path to the indirect item. */ 175 struct treepath *path, /* path to the indirect item. */
176 const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ 176 const struct cpu_key *item_key, /* Key to look for
177 * unformatted node
178 * pointer to be cut. */
177 loff_t n_new_file_size, /* New file size. */ 179 loff_t n_new_file_size, /* New file size. */
178 char *p_c_mode) 180 char *mode)
179{ 181{
180 struct super_block *sb = inode->i_sb; 182 struct super_block *sb = inode->i_sb;
181 struct item_head s_ih; 183 struct item_head s_ih;
@@ -189,10 +191,10 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
189 191
190 REISERFS_SB(sb)->s_indirect2direct++; 192 REISERFS_SB(sb)->s_indirect2direct++;
191 193
192 *p_c_mode = M_SKIP_BALANCING; 194 *mode = M_SKIP_BALANCING;
193 195
194 /* store item head path points to. */ 196 /* store item head path points to. */
195 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); 197 copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
196 198
197 tail_len = (n_new_file_size & (n_block_size - 1)); 199 tail_len = (n_new_file_size & (n_block_size - 1));
198 if (get_inode_sd_version(inode) == STAT_DATA_V2) 200 if (get_inode_sd_version(inode) == STAT_DATA_V2)
@@ -211,14 +213,14 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
211 213
212 tail = (char *)kmap(page); /* this can schedule */ 214 tail = (char *)kmap(page); /* this can schedule */
213 215
214 if (path_changed(&s_ih, p_s_path)) { 216 if (path_changed(&s_ih, path)) {
215 /* re-search indirect item */ 217 /* re-search indirect item */
216 if (search_for_position_by_key(sb, p_s_item_key, p_s_path) 218 if (search_for_position_by_key(sb, item_key, path)
217 == POSITION_NOT_FOUND) 219 == POSITION_NOT_FOUND)
218 reiserfs_panic(sb, "PAP-5520", 220 reiserfs_panic(sb, "PAP-5520",
219 "item to be converted %K does not exist", 221 "item to be converted %K does not exist",
220 p_s_item_key); 222 item_key);
221 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); 223 copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
222#ifdef CONFIG_REISERFS_CHECK 224#ifdef CONFIG_REISERFS_CHECK
223 pos = le_ih_k_offset(&s_ih) - 1 + 225 pos = le_ih_k_offset(&s_ih) - 1 +
224 (ih_item_len(&s_ih) / UNFM_P_SIZE - 226 (ih_item_len(&s_ih) / UNFM_P_SIZE -
@@ -240,13 +242,13 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
240 */ 242 */
241 tail = tail + (pos & (PAGE_CACHE_SIZE - 1)); 243 tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
242 244
243 PATH_LAST_POSITION(p_s_path)++; 245 PATH_LAST_POSITION(path)++;
244 246
245 key = *p_s_item_key; 247 key = *item_key;
246 set_cpu_key_k_type(&key, TYPE_DIRECT); 248 set_cpu_key_k_type(&key, TYPE_DIRECT);
247 key.key_length = 4; 249 key.key_length = 4;
248 /* Insert tail as new direct item in the tree */ 250 /* Insert tail as new direct item in the tree */
249 if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode, 251 if (reiserfs_insert_item(th, path, &key, &s_ih, inode,
250 tail ? tail : NULL) < 0) { 252 tail ? tail : NULL) < 0) {
251 /* No disk memory. So we can not convert last unformatted node 253 /* No disk memory. So we can not convert last unformatted node
252 to the direct item. In this case we used to adjust 254 to the direct item. In this case we used to adjust
@@ -268,7 +270,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th,
268 270
269 /* We have inserted new direct item and must remove last 271 /* We have inserted new direct item and must remove last
270 unformatted node. */ 272 unformatted node. */
271 *p_c_mode = M_CUT; 273 *mode = M_CUT;
272 274
273 /* we store position of first direct item in the in-core inode */ 275 /* we store position of first direct item in the in-core inode */
274 /* mark_file_with_tail (inode, pos1 + 1); */ 276 /* mark_file_with_tail (inode, pos1 + 1); */