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.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index 27311a5f0469..5c5ee0d0d6a8 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -170,12 +170,14 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
170 what we expect from it (number of cut bytes). But when tail remains 170 what we expect from it (number of cut bytes). But when tail remains
171 in the unformatted node, we set mode to SKIP_BALANCING and unlock 171 in the unformatted node, we set mode to SKIP_BALANCING and unlock
172 inode */ 172 inode */
173int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */ 173int indirect2direct(struct reiserfs_transaction_handle *th,
174 struct inode *inode, struct page *page,
175 struct treepath *p_s_path, /* path to the indirect item. */
174 const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */ 176 const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
175 loff_t n_new_file_size, /* New file size. */ 177 loff_t n_new_file_size, /* New file size. */
176 char *p_c_mode) 178 char *p_c_mode)
177{ 179{
178 struct super_block *sb = p_s_inode->i_sb; 180 struct super_block *sb = inode->i_sb;
179 struct item_head s_ih; 181 struct item_head s_ih;
180 unsigned long n_block_size = sb->s_blocksize; 182 unsigned long n_block_size = sb->s_blocksize;
181 char *tail; 183 char *tail;
@@ -193,7 +195,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
193 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); 195 copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
194 196
195 tail_len = (n_new_file_size & (n_block_size - 1)); 197 tail_len = (n_new_file_size & (n_block_size - 1));
196 if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2) 198 if (get_inode_sd_version(inode) == STAT_DATA_V2)
197 round_tail_len = ROUND_UP(tail_len); 199 round_tail_len = ROUND_UP(tail_len);
198 else 200 else
199 round_tail_len = tail_len; 201 round_tail_len = tail_len;
@@ -228,7 +230,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
228 } 230 }
229 231
230 /* Set direct item header to insert. */ 232 /* Set direct item header to insert. */
231 make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode), 233 make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode),
232 pos1 + 1, TYPE_DIRECT, round_tail_len, 234 pos1 + 1, TYPE_DIRECT, round_tail_len,
233 0xffff /*ih_free_space */ ); 235 0xffff /*ih_free_space */ );
234 236
@@ -244,7 +246,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
244 set_cpu_key_k_type(&key, TYPE_DIRECT); 246 set_cpu_key_k_type(&key, TYPE_DIRECT);
245 key.key_length = 4; 247 key.key_length = 4;
246 /* Insert tail as new direct item in the tree */ 248 /* Insert tail as new direct item in the tree */
247 if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode, 249 if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, inode,
248 tail ? tail : NULL) < 0) { 250 tail ? tail : NULL) < 0) {
249 /* No disk memory. So we can not convert last unformatted node 251 /* No disk memory. So we can not convert last unformatted node
250 to the direct item. In this case we used to adjust 252 to the direct item. In this case we used to adjust
@@ -258,7 +260,7 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
258 kunmap(page); 260 kunmap(page);
259 261
260 /* make sure to get the i_blocks changes from reiserfs_insert_item */ 262 /* make sure to get the i_blocks changes from reiserfs_insert_item */
261 reiserfs_update_sd(th, p_s_inode); 263 reiserfs_update_sd(th, inode);
262 264
263 // note: we have now the same as in above direct2indirect 265 // note: we have now the same as in above direct2indirect
264 // conversion: there are two keys which have matching first three 266 // conversion: there are two keys which have matching first three
@@ -269,8 +271,8 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
269 *p_c_mode = M_CUT; 271 *p_c_mode = M_CUT;
270 272
271 /* we store position of first direct item in the in-core inode */ 273 /* we store position of first direct item in the in-core inode */
272 //mark_file_with_tail (p_s_inode, pos1 + 1); 274 /* mark_file_with_tail (inode, pos1 + 1); */
273 REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1; 275 REISERFS_I(inode)->i_first_direct_byte = pos1 + 1;
274 276
275 return n_block_size - round_tail_len; 277 return n_block_size - round_tail_len;
276} 278}