| .. | .. |
|---|
| 107 | 107 | */ |
|---|
| 108 | 108 | replace_rec.e_flags = ext_flags & ~OCFS2_EXT_REFCOUNTED; |
|---|
| 109 | 109 | |
|---|
| 110 | | - ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), |
|---|
| 111 | | - context->et.et_root_bh, |
|---|
| 112 | | - OCFS2_JOURNAL_ACCESS_WRITE); |
|---|
| 113 | | - if (ret) { |
|---|
| 114 | | - mlog_errno(ret); |
|---|
| 115 | | - goto out; |
|---|
| 116 | | - } |
|---|
| 117 | | - |
|---|
| 118 | 110 | ret = ocfs2_split_extent(handle, &context->et, path, index, |
|---|
| 119 | 111 | &replace_rec, context->meta_ac, |
|---|
| 120 | 112 | &context->dealloc); |
|---|
| .. | .. |
|---|
| 122 | 114 | mlog_errno(ret); |
|---|
| 123 | 115 | goto out; |
|---|
| 124 | 116 | } |
|---|
| 125 | | - |
|---|
| 126 | | - ocfs2_journal_dirty(handle, context->et.et_root_bh); |
|---|
| 127 | 117 | |
|---|
| 128 | 118 | context->new_phys_cpos = new_p_cpos; |
|---|
| 129 | 119 | |
|---|
| .. | .. |
|---|
| 446 | 436 | bg = (struct ocfs2_group_desc *)gd_bh->b_data; |
|---|
| 447 | 437 | |
|---|
| 448 | 438 | if (vict_blkno < (le64_to_cpu(bg->bg_blkno) + |
|---|
| 449 | | - le16_to_cpu(bg->bg_bits))) { |
|---|
| 439 | + (le16_to_cpu(bg->bg_bits) << bits_per_unit))) { |
|---|
| 450 | 440 | |
|---|
| 451 | 441 | *ret_bh = gd_bh; |
|---|
| 452 | 442 | *vict_bit = (vict_blkno - blkno) >> |
|---|
| .. | .. |
|---|
| 561 | 551 | last_free_bits++; |
|---|
| 562 | 552 | |
|---|
| 563 | 553 | if (last_free_bits == move_len) { |
|---|
| 554 | + i -= move_len; |
|---|
| 564 | 555 | *goal_bit = i; |
|---|
| 565 | 556 | *phys_cpos = base_cpos + i; |
|---|
| 566 | 557 | break; |
|---|
| .. | .. |
|---|
| 1032 | 1023 | |
|---|
| 1033 | 1024 | context->range = ⦥ |
|---|
| 1034 | 1025 | |
|---|
| 1026 | + /* |
|---|
| 1027 | + * ok, the default theshold for the defragmentation |
|---|
| 1028 | + * is 1M, since our maximum clustersize was 1M also. |
|---|
| 1029 | + * any thought? |
|---|
| 1030 | + */ |
|---|
| 1031 | + if (!range.me_threshold) |
|---|
| 1032 | + range.me_threshold = 1024 * 1024; |
|---|
| 1033 | + |
|---|
| 1034 | + if (range.me_threshold > i_size_read(inode)) |
|---|
| 1035 | + range.me_threshold = i_size_read(inode); |
|---|
| 1036 | + |
|---|
| 1035 | 1037 | if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) { |
|---|
| 1036 | 1038 | context->auto_defrag = 1; |
|---|
| 1037 | | - /* |
|---|
| 1038 | | - * ok, the default theshold for the defragmentation |
|---|
| 1039 | | - * is 1M, since our maximum clustersize was 1M also. |
|---|
| 1040 | | - * any thought? |
|---|
| 1041 | | - */ |
|---|
| 1042 | | - if (!range.me_threshold) |
|---|
| 1043 | | - range.me_threshold = 1024 * 1024; |
|---|
| 1044 | | - |
|---|
| 1045 | | - if (range.me_threshold > i_size_read(inode)) |
|---|
| 1046 | | - range.me_threshold = i_size_read(inode); |
|---|
| 1047 | 1039 | |
|---|
| 1048 | 1040 | if (range.me_flags & OCFS2_MOVE_EXT_FL_PART_DEFRAG) |
|---|
| 1049 | 1041 | context->partial = 1; |
|---|