diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ufs/balloc.c | 5 | ||||
-rw-r--r-- | fs/ufs/inode.c | 12 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 36 |
3 files changed, 35 insertions, 18 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index b8fa34af87cc..841ac25fd950 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -482,8 +482,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
482 | if (result) { | 482 | if (result) { |
483 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, | 483 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
484 | locked_page != NULL); | 484 | locked_page != NULL); |
485 | ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp, | 485 | ufs_change_blocknr(inode, fragment - oldcount, oldcount, |
486 | result, locked_page); | 486 | uspi->s_sbbase + tmp, |
487 | uspi->s_sbbase + result, locked_page); | ||
487 | ufs_cpu_to_data_ptr(sb, p, result); | 488 | ufs_cpu_to_data_ptr(sb, p, result); |
488 | *err = 0; | 489 | *err = 0; |
489 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); | 490 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 366618dd698d..013d7afe7cde 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -212,7 +212,7 @@ repeat: | |||
212 | brelse (result); | 212 | brelse (result); |
213 | goto repeat; | 213 | goto repeat; |
214 | } else { | 214 | } else { |
215 | *phys = tmp + blockoff; | 215 | *phys = uspi->s_sbbase + tmp + blockoff; |
216 | return NULL; | 216 | return NULL; |
217 | } | 217 | } |
218 | } | 218 | } |
@@ -282,9 +282,9 @@ repeat: | |||
282 | } | 282 | } |
283 | 283 | ||
284 | if (!phys) { | 284 | if (!phys) { |
285 | result = sb_getblk(sb, tmp + blockoff); | 285 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
286 | } else { | 286 | } else { |
287 | *phys = tmp + blockoff; | 287 | *phys = uspi->s_sbbase + tmp + blockoff; |
288 | result = NULL; | 288 | result = NULL; |
289 | *err = 0; | 289 | *err = 0; |
290 | *new = 1; | 290 | *new = 1; |
@@ -368,7 +368,7 @@ repeat: | |||
368 | brelse (result); | 368 | brelse (result); |
369 | goto repeat; | 369 | goto repeat; |
370 | } else { | 370 | } else { |
371 | *phys = tmp + blockoff; | 371 | *phys = uspi->s_sbbase + tmp + blockoff; |
372 | goto out; | 372 | goto out; |
373 | } | 373 | } |
374 | } | 374 | } |
@@ -389,9 +389,9 @@ repeat: | |||
389 | 389 | ||
390 | 390 | ||
391 | if (!phys) { | 391 | if (!phys) { |
392 | result = sb_getblk(sb, tmp + blockoff); | 392 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
393 | } else { | 393 | } else { |
394 | *phys = tmp + blockoff; | 394 | *phys = uspi->s_sbbase + tmp + blockoff; |
395 | *new = 1; | 395 | *new = 1; |
396 | } | 396 | } |
397 | 397 | ||
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 749581fa7729..52fb2b59f06e 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -74,7 +74,7 @@ static int ufs_trunc_direct(struct inode *inode) | |||
74 | unsigned i, tmp; | 74 | unsigned i, tmp; |
75 | int retry; | 75 | int retry; |
76 | 76 | ||
77 | UFSD("ENTER\n"); | 77 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
78 | 78 | ||
79 | sb = inode->i_sb; | 79 | sb = inode->i_sb; |
80 | uspi = UFS_SB(sb)->s_uspi; | 80 | uspi = UFS_SB(sb)->s_uspi; |
@@ -96,8 +96,8 @@ static int ufs_trunc_direct(struct inode *inode) | |||
96 | block2 = ufs_fragstoblks (frag3); | 96 | block2 = ufs_fragstoblks (frag3); |
97 | } | 97 | } |
98 | 98 | ||
99 | UFSD("frag1 %llu, frag2 %llu, block1 %llu, block2 %llu, frag3 %llu," | 99 | UFSD("ino %lu, frag1 %llu, frag2 %llu, block1 %llu, block2 %llu," |
100 | " frag4 %llu\n", | 100 | " frag3 %llu, frag4 %llu\n", inode->i_ino, |
101 | (unsigned long long)frag1, (unsigned long long)frag2, | 101 | (unsigned long long)frag1, (unsigned long long)frag2, |
102 | (unsigned long long)block1, (unsigned long long)block2, | 102 | (unsigned long long)block1, (unsigned long long)block2, |
103 | (unsigned long long)frag3, (unsigned long long)frag4); | 103 | (unsigned long long)frag3, (unsigned long long)frag4); |
@@ -163,7 +163,7 @@ next1: | |||
163 | mark_inode_dirty(inode); | 163 | mark_inode_dirty(inode); |
164 | next3: | 164 | next3: |
165 | 165 | ||
166 | UFSD("EXIT\n"); | 166 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
167 | return retry; | 167 | return retry; |
168 | } | 168 | } |
169 | 169 | ||
@@ -248,7 +248,7 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p) | |||
248 | } | 248 | } |
249 | ubh_brelse (ind_ubh); | 249 | ubh_brelse (ind_ubh); |
250 | 250 | ||
251 | UFSD("EXIT\n"); | 251 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
252 | 252 | ||
253 | return retry; | 253 | return retry; |
254 | } | 254 | } |
@@ -262,7 +262,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p) | |||
262 | void *dind; | 262 | void *dind; |
263 | int retry = 0; | 263 | int retry = 0; |
264 | 264 | ||
265 | UFSD("ENTER\n"); | 265 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
266 | 266 | ||
267 | sb = inode->i_sb; | 267 | sb = inode->i_sb; |
268 | uspi = UFS_SB(sb)->s_uspi; | 268 | uspi = UFS_SB(sb)->s_uspi; |
@@ -312,7 +312,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p) | |||
312 | } | 312 | } |
313 | ubh_brelse (dind_bh); | 313 | ubh_brelse (dind_bh); |
314 | 314 | ||
315 | UFSD("EXIT\n"); | 315 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
316 | 316 | ||
317 | return retry; | 317 | return retry; |
318 | } | 318 | } |
@@ -327,7 +327,7 @@ static int ufs_trunc_tindirect(struct inode *inode) | |||
327 | void *tind, *p; | 327 | void *tind, *p; |
328 | int retry; | 328 | int retry; |
329 | 329 | ||
330 | UFSD("ENTER\n"); | 330 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
331 | 331 | ||
332 | retry = 0; | 332 | retry = 0; |
333 | 333 | ||
@@ -372,19 +372,21 @@ static int ufs_trunc_tindirect(struct inode *inode) | |||
372 | } | 372 | } |
373 | ubh_brelse (tind_bh); | 373 | ubh_brelse (tind_bh); |
374 | 374 | ||
375 | UFSD("EXIT\n"); | 375 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
376 | return retry; | 376 | return retry; |
377 | } | 377 | } |
378 | 378 | ||
379 | static int ufs_alloc_lastblock(struct inode *inode) | 379 | static int ufs_alloc_lastblock(struct inode *inode) |
380 | { | 380 | { |
381 | int err = 0; | 381 | int err = 0; |
382 | struct super_block *sb = inode->i_sb; | ||
382 | struct address_space *mapping = inode->i_mapping; | 383 | struct address_space *mapping = inode->i_mapping; |
383 | struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi; | 384 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
384 | unsigned i, end; | 385 | unsigned i, end; |
385 | sector_t lastfrag; | 386 | sector_t lastfrag; |
386 | struct page *lastpage; | 387 | struct page *lastpage; |
387 | struct buffer_head *bh; | 388 | struct buffer_head *bh; |
389 | u64 phys64; | ||
388 | 390 | ||
389 | lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; | 391 | lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; |
390 | 392 | ||
@@ -424,6 +426,20 @@ static int ufs_alloc_lastblock(struct inode *inode) | |||
424 | set_page_dirty(lastpage); | 426 | set_page_dirty(lastpage); |
425 | } | 427 | } |
426 | 428 | ||
429 | if (lastfrag >= UFS_IND_FRAGMENT) { | ||
430 | end = uspi->s_fpb - ufs_fragnum(lastfrag) - 1; | ||
431 | phys64 = bh->b_blocknr + 1; | ||
432 | for (i = 0; i < end; ++i) { | ||
433 | bh = sb_getblk(sb, i + phys64); | ||
434 | lock_buffer(bh); | ||
435 | memset(bh->b_data, 0, sb->s_blocksize); | ||
436 | set_buffer_uptodate(bh); | ||
437 | mark_buffer_dirty(bh); | ||
438 | unlock_buffer(bh); | ||
439 | sync_dirty_buffer(bh); | ||
440 | brelse(bh); | ||
441 | } | ||
442 | } | ||
427 | out_unlock: | 443 | out_unlock: |
428 | ufs_put_locked_page(lastpage); | 444 | ufs_put_locked_page(lastpage); |
429 | out: | 445 | out: |