hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/ocfs2/move_extents.c
....@@ -107,14 +107,6 @@
107107 */
108108 replace_rec.e_flags = ext_flags & ~OCFS2_EXT_REFCOUNTED;
109109
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
-
118110 ret = ocfs2_split_extent(handle, &context->et, path, index,
119111 &replace_rec, context->meta_ac,
120112 &context->dealloc);
....@@ -122,8 +114,6 @@
122114 mlog_errno(ret);
123115 goto out;
124116 }
125
-
126
- ocfs2_journal_dirty(handle, context->et.et_root_bh);
127117
128118 context->new_phys_cpos = new_p_cpos;
129119
....@@ -446,7 +436,7 @@
446436 bg = (struct ocfs2_group_desc *)gd_bh->b_data;
447437
448438 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))) {
450440
451441 *ret_bh = gd_bh;
452442 *vict_bit = (vict_blkno - blkno) >>
....@@ -561,6 +551,7 @@
561551 last_free_bits++;
562552
563553 if (last_free_bits == move_len) {
554
+ i -= move_len;
564555 *goal_bit = i;
565556 *phys_cpos = base_cpos + i;
566557 break;
....@@ -1032,18 +1023,19 @@
10321023
10331024 context->range = &range;
10341025
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
+
10351037 if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) {
10361038 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);
10471039
10481040 if (range.me_flags & OCFS2_MOVE_EXT_FL_PART_DEFRAG)
10491041 context->partial = 1;