diff options
Diffstat (limited to 'fs/ocfs2/inode.c')
| -rw-r--r-- | fs/ocfs2/inode.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 5ff8549eb1a3..0bd86a137591 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
| @@ -487,7 +487,6 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
| 487 | struct buffer_head *fe_bh) | 487 | struct buffer_head *fe_bh) |
| 488 | { | 488 | { |
| 489 | int status = 0; | 489 | int status = 0; |
| 490 | handle_t *handle = NULL; | ||
| 491 | struct ocfs2_truncate_context *tc = NULL; | 490 | struct ocfs2_truncate_context *tc = NULL; |
| 492 | struct ocfs2_dinode *fe; | 491 | struct ocfs2_dinode *fe; |
| 493 | 492 | ||
| @@ -495,41 +494,20 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
| 495 | 494 | ||
| 496 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | 495 | fe = (struct ocfs2_dinode *) fe_bh->b_data; |
| 497 | 496 | ||
| 498 | /* zero allocation, zero truncate :) */ | 497 | if (fe->i_clusters) { |
| 499 | if (!fe->i_clusters) | 498 | status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc); |
| 500 | goto bail; | 499 | if (status < 0) { |
| 501 | 500 | mlog_errno(status); | |
| 502 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 501 | goto out; |
| 503 | if (IS_ERR(handle)) { | 502 | } |
| 504 | status = PTR_ERR(handle); | ||
| 505 | handle = NULL; | ||
| 506 | mlog_errno(status); | ||
| 507 | goto bail; | ||
| 508 | } | ||
| 509 | |||
| 510 | status = ocfs2_set_inode_size(handle, inode, fe_bh, 0ULL); | ||
| 511 | if (status < 0) { | ||
| 512 | mlog_errno(status); | ||
| 513 | goto bail; | ||
| 514 | } | ||
| 515 | |||
| 516 | ocfs2_commit_trans(osb, handle); | ||
| 517 | handle = NULL; | ||
| 518 | |||
| 519 | status = ocfs2_prepare_truncate(osb, inode, fe_bh, &tc); | ||
| 520 | if (status < 0) { | ||
| 521 | mlog_errno(status); | ||
| 522 | goto bail; | ||
| 523 | } | ||
| 524 | 503 | ||
| 525 | status = ocfs2_commit_truncate(osb, inode, fe_bh, tc); | 504 | status = ocfs2_commit_truncate(osb, inode, fe_bh, tc); |
| 526 | if (status < 0) { | 505 | if (status < 0) { |
| 527 | mlog_errno(status); | 506 | mlog_errno(status); |
| 528 | goto bail; | 507 | goto out; |
| 508 | } | ||
| 529 | } | 509 | } |
| 530 | bail: | 510 | out: |
| 531 | if (handle) | ||
| 532 | ocfs2_commit_trans(osb, handle); | ||
| 533 | 511 | ||
| 534 | mlog_exit(status); | 512 | mlog_exit(status); |
| 535 | return status; | 513 | return status; |
