diff options
-rw-r--r-- | fs/ocfs2/localalloc.c | 198 | ||||
-rw-r--r-- | fs/ocfs2/localalloc.h | 4 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 23 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 31 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 4 |
6 files changed, 230 insertions, 31 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index b05ce6642919..f71658adddb5 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -73,16 +73,51 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
73 | static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, | 73 | static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, |
74 | struct inode *local_alloc_inode); | 74 | struct inode *local_alloc_inode); |
75 | 75 | ||
76 | static inline int ocfs2_la_state_enabled(struct ocfs2_super *osb) | ||
77 | { | ||
78 | return (osb->local_alloc_state == OCFS2_LA_THROTTLED || | ||
79 | osb->local_alloc_state == OCFS2_LA_ENABLED); | ||
80 | } | ||
81 | |||
82 | void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, | ||
83 | unsigned int num_clusters) | ||
84 | { | ||
85 | spin_lock(&osb->osb_lock); | ||
86 | if (osb->local_alloc_state == OCFS2_LA_DISABLED || | ||
87 | osb->local_alloc_state == OCFS2_LA_THROTTLED) | ||
88 | if (num_clusters >= osb->local_alloc_default_bits) { | ||
89 | cancel_delayed_work(&osb->la_enable_wq); | ||
90 | osb->local_alloc_state = OCFS2_LA_ENABLED; | ||
91 | } | ||
92 | spin_unlock(&osb->osb_lock); | ||
93 | } | ||
94 | |||
95 | void ocfs2_la_enable_worker(struct work_struct *work) | ||
96 | { | ||
97 | struct ocfs2_super *osb = | ||
98 | container_of(work, struct ocfs2_super, | ||
99 | la_enable_wq.work); | ||
100 | spin_lock(&osb->osb_lock); | ||
101 | osb->local_alloc_state = OCFS2_LA_ENABLED; | ||
102 | spin_unlock(&osb->osb_lock); | ||
103 | } | ||
104 | |||
76 | /* | 105 | /* |
77 | * Tell us whether a given allocation should use the local alloc | 106 | * Tell us whether a given allocation should use the local alloc |
78 | * file. Otherwise, it has to go to the main bitmap. | 107 | * file. Otherwise, it has to go to the main bitmap. |
108 | * | ||
109 | * This function does semi-dirty reads of local alloc size and state! | ||
110 | * This is ok however, as the values are re-checked once under mutex. | ||
79 | */ | 111 | */ |
80 | int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits) | 112 | int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits) |
81 | { | 113 | { |
82 | int la_bits = osb->local_alloc_bits; | ||
83 | int ret = 0; | 114 | int ret = 0; |
115 | int la_bits; | ||
116 | |||
117 | spin_lock(&osb->osb_lock); | ||
118 | la_bits = osb->local_alloc_bits; | ||
84 | 119 | ||
85 | if (osb->local_alloc_state != OCFS2_LA_ENABLED) | 120 | if (!ocfs2_la_state_enabled(osb)) |
86 | goto bail; | 121 | goto bail; |
87 | 122 | ||
88 | /* la_bits should be at least twice the size (in clusters) of | 123 | /* la_bits should be at least twice the size (in clusters) of |
@@ -96,6 +131,7 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits) | |||
96 | bail: | 131 | bail: |
97 | mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n", | 132 | mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n", |
98 | osb->local_alloc_state, (unsigned long long)bits, la_bits, ret); | 133 | osb->local_alloc_state, (unsigned long long)bits, la_bits, ret); |
134 | spin_unlock(&osb->osb_lock); | ||
99 | return ret; | 135 | return ret; |
100 | } | 136 | } |
101 | 137 | ||
@@ -208,6 +244,9 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) | |||
208 | 244 | ||
209 | mlog_entry_void(); | 245 | mlog_entry_void(); |
210 | 246 | ||
247 | cancel_delayed_work(&osb->la_enable_wq); | ||
248 | flush_workqueue(ocfs2_wq); | ||
249 | |||
211 | if (osb->local_alloc_state == OCFS2_LA_UNUSED) | 250 | if (osb->local_alloc_state == OCFS2_LA_UNUSED) |
212 | goto out; | 251 | goto out; |
213 | 252 | ||
@@ -445,7 +484,7 @@ out: | |||
445 | } | 484 | } |
446 | 485 | ||
447 | /* | 486 | /* |
448 | * make sure we've got at least bitswanted contiguous bits in the | 487 | * make sure we've got at least bits_wanted contiguous bits in the |
449 | * local alloc. You lose them when you drop i_mutex. | 488 | * local alloc. You lose them when you drop i_mutex. |
450 | * | 489 | * |
451 | * We will add ourselves to the transaction passed in, but may start | 490 | * We will add ourselves to the transaction passed in, but may start |
@@ -476,16 +515,18 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
476 | 515 | ||
477 | mutex_lock(&local_alloc_inode->i_mutex); | 516 | mutex_lock(&local_alloc_inode->i_mutex); |
478 | 517 | ||
479 | if (osb->local_alloc_state != OCFS2_LA_ENABLED) { | 518 | /* |
480 | status = -ENOSPC; | 519 | * We must double check state and allocator bits because |
481 | goto bail; | 520 | * another process may have changed them while holding i_mutex. |
482 | } | 521 | */ |
483 | 522 | spin_lock(&osb->osb_lock); | |
484 | if (bits_wanted > osb->local_alloc_bits) { | 523 | if (!ocfs2_la_state_enabled(osb) || |
485 | mlog(0, "Asking for more than my max window size!\n"); | 524 | (bits_wanted > osb->local_alloc_bits)) { |
525 | spin_unlock(&osb->osb_lock); | ||
486 | status = -ENOSPC; | 526 | status = -ENOSPC; |
487 | goto bail; | 527 | goto bail; |
488 | } | 528 | } |
529 | spin_unlock(&osb->osb_lock); | ||
489 | 530 | ||
490 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; | 531 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; |
491 | 532 | ||
@@ -513,6 +554,21 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
513 | mlog_errno(status); | 554 | mlog_errno(status); |
514 | goto bail; | 555 | goto bail; |
515 | } | 556 | } |
557 | |||
558 | /* | ||
559 | * Under certain conditions, the window slide code | ||
560 | * might have reduced the number of bits available or | ||
561 | * disabled the the local alloc entirely. Re-check | ||
562 | * here and return -ENOSPC if necessary. | ||
563 | */ | ||
564 | status = -ENOSPC; | ||
565 | if (!ocfs2_la_state_enabled(osb)) | ||
566 | goto bail; | ||
567 | |||
568 | free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) - | ||
569 | le32_to_cpu(alloc->id1.bitmap1.i_used); | ||
570 | if (bits_wanted > free_bits) | ||
571 | goto bail; | ||
516 | } | 572 | } |
517 | 573 | ||
518 | ac->ac_inode = local_alloc_inode; | 574 | ac->ac_inode = local_alloc_inode; |
@@ -780,6 +836,85 @@ bail: | |||
780 | return status; | 836 | return status; |
781 | } | 837 | } |
782 | 838 | ||
839 | enum ocfs2_la_event { | ||
840 | OCFS2_LA_EVENT_SLIDE, /* Normal window slide. */ | ||
841 | OCFS2_LA_EVENT_FRAGMENTED, /* The global bitmap has | ||
842 | * enough bits theoretically | ||
843 | * free, but a contiguous | ||
844 | * allocation could not be | ||
845 | * found. */ | ||
846 | OCFS2_LA_EVENT_ENOSPC, /* Global bitmap doesn't have | ||
847 | * enough bits free to satisfy | ||
848 | * our request. */ | ||
849 | }; | ||
850 | #define OCFS2_LA_ENABLE_INTERVAL (30 * HZ) | ||
851 | /* | ||
852 | * Given an event, calculate the size of our next local alloc window. | ||
853 | * | ||
854 | * This should always be called under i_mutex of the local alloc inode | ||
855 | * so that local alloc disabling doesn't race with processes trying to | ||
856 | * use the allocator. | ||
857 | * | ||
858 | * Returns the state which the local alloc was left in. This value can | ||
859 | * be ignored by some paths. | ||
860 | */ | ||
861 | static int ocfs2_recalc_la_window(struct ocfs2_super *osb, | ||
862 | enum ocfs2_la_event event) | ||
863 | { | ||
864 | unsigned int bits; | ||
865 | int state; | ||
866 | |||
867 | spin_lock(&osb->osb_lock); | ||
868 | if (osb->local_alloc_state == OCFS2_LA_DISABLED) { | ||
869 | WARN_ON_ONCE(osb->local_alloc_state == OCFS2_LA_DISABLED); | ||
870 | goto out_unlock; | ||
871 | } | ||
872 | |||
873 | /* | ||
874 | * ENOSPC and fragmentation are treated similarly for now. | ||
875 | */ | ||
876 | if (event == OCFS2_LA_EVENT_ENOSPC || | ||
877 | event == OCFS2_LA_EVENT_FRAGMENTED) { | ||
878 | /* | ||
879 | * We ran out of contiguous space in the primary | ||
880 | * bitmap. Drastically reduce the number of bits used | ||
881 | * by local alloc until we have to disable it. | ||
882 | */ | ||
883 | bits = osb->local_alloc_bits >> 1; | ||
884 | if (bits > ocfs2_megabytes_to_clusters(osb->sb, 1)) { | ||
885 | /* | ||
886 | * By setting state to THROTTLED, we'll keep | ||
887 | * the number of local alloc bits used down | ||
888 | * until an event occurs which would give us | ||
889 | * reason to assume the bitmap situation might | ||
890 | * have changed. | ||
891 | */ | ||
892 | osb->local_alloc_state = OCFS2_LA_THROTTLED; | ||
893 | osb->local_alloc_bits = bits; | ||
894 | } else { | ||
895 | osb->local_alloc_state = OCFS2_LA_DISABLED; | ||
896 | } | ||
897 | queue_delayed_work(ocfs2_wq, &osb->la_enable_wq, | ||
898 | OCFS2_LA_ENABLE_INTERVAL); | ||
899 | goto out_unlock; | ||
900 | } | ||
901 | |||
902 | /* | ||
903 | * Don't increase the size of the local alloc window until we | ||
904 | * know we might be able to fulfill the request. Otherwise, we | ||
905 | * risk bouncing around the global bitmap during periods of | ||
906 | * low space. | ||
907 | */ | ||
908 | if (osb->local_alloc_state != OCFS2_LA_THROTTLED) | ||
909 | osb->local_alloc_bits = osb->local_alloc_default_bits; | ||
910 | |||
911 | out_unlock: | ||
912 | state = osb->local_alloc_state; | ||
913 | spin_unlock(&osb->osb_lock); | ||
914 | |||
915 | return state; | ||
916 | } | ||
917 | |||
783 | static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, | 918 | static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, |
784 | struct ocfs2_alloc_context **ac, | 919 | struct ocfs2_alloc_context **ac, |
785 | struct inode **bitmap_inode, | 920 | struct inode **bitmap_inode, |
@@ -794,12 +929,21 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, | |||
794 | goto bail; | 929 | goto bail; |
795 | } | 930 | } |
796 | 931 | ||
932 | retry_enospc: | ||
797 | (*ac)->ac_bits_wanted = osb->local_alloc_bits; | 933 | (*ac)->ac_bits_wanted = osb->local_alloc_bits; |
798 | 934 | ||
799 | status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); | 935 | status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); |
936 | if (status == -ENOSPC) { | ||
937 | if (ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_ENOSPC) == | ||
938 | OCFS2_LA_DISABLED) | ||
939 | goto bail; | ||
940 | |||
941 | ocfs2_free_ac_resource(*ac); | ||
942 | memset(*ac, 0, sizeof(struct ocfs2_alloc_context)); | ||
943 | goto retry_enospc; | ||
944 | } | ||
800 | if (status < 0) { | 945 | if (status < 0) { |
801 | if (status != -ENOSPC) | 946 | mlog_errno(status); |
802 | mlog_errno(status); | ||
803 | goto bail; | 947 | goto bail; |
804 | } | 948 | } |
805 | 949 | ||
@@ -852,6 +996,34 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
852 | * the more specific cluster api to claim bits. */ | 996 | * the more specific cluster api to claim bits. */ |
853 | status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, | 997 | status = ocfs2_claim_clusters(osb, handle, ac, osb->local_alloc_bits, |
854 | &cluster_off, &cluster_count); | 998 | &cluster_off, &cluster_count); |
999 | if (status == -ENOSPC) { | ||
1000 | retry_enospc: | ||
1001 | /* | ||
1002 | * Note: We could also try syncing the journal here to | ||
1003 | * allow use of any free bits which the current | ||
1004 | * transaction can't give us access to. --Mark | ||
1005 | */ | ||
1006 | if (ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_FRAGMENTED) == | ||
1007 | OCFS2_LA_DISABLED) | ||
1008 | goto bail; | ||
1009 | |||
1010 | status = ocfs2_claim_clusters(osb, handle, ac, | ||
1011 | osb->local_alloc_bits, | ||
1012 | &cluster_off, | ||
1013 | &cluster_count); | ||
1014 | if (status == -ENOSPC) | ||
1015 | goto retry_enospc; | ||
1016 | /* | ||
1017 | * We only shrunk the *minimum* number of in our | ||
1018 | * request - it's entirely possible that the allocator | ||
1019 | * might give us more than we asked for. | ||
1020 | */ | ||
1021 | if (status == 0) { | ||
1022 | spin_lock(&osb->osb_lock); | ||
1023 | osb->local_alloc_bits = cluster_count; | ||
1024 | spin_unlock(&osb->osb_lock); | ||
1025 | } | ||
1026 | } | ||
855 | if (status < 0) { | 1027 | if (status < 0) { |
856 | if (status != -ENOSPC) | 1028 | if (status != -ENOSPC) |
857 | mlog_errno(status); | 1029 | mlog_errno(status); |
@@ -895,6 +1067,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, | |||
895 | 1067 | ||
896 | mlog_entry_void(); | 1068 | mlog_entry_void(); |
897 | 1069 | ||
1070 | ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_SLIDE); | ||
1071 | |||
898 | /* This will lock the main bitmap for us. */ | 1072 | /* This will lock the main bitmap for us. */ |
899 | status = ocfs2_local_alloc_reserve_for_window(osb, | 1073 | status = ocfs2_local_alloc_reserve_for_window(osb, |
900 | &ac, | 1074 | &ac, |
diff --git a/fs/ocfs2/localalloc.h b/fs/ocfs2/localalloc.h index 3f76631e110c..ac5ea9f86653 100644 --- a/fs/ocfs2/localalloc.h +++ b/fs/ocfs2/localalloc.h | |||
@@ -52,4 +52,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
52 | u32 *bit_off, | 52 | u32 *bit_off, |
53 | u32 *num_bits); | 53 | u32 *num_bits); |
54 | 54 | ||
55 | void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, | ||
56 | unsigned int num_clusters); | ||
57 | void ocfs2_la_enable_worker(struct work_struct *work); | ||
58 | |||
55 | #endif /* OCFS2_LOCALALLOC_H */ | 59 | #endif /* OCFS2_LOCALALLOC_H */ |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 43dd42e313a1..4d6e200a4843 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -171,9 +171,13 @@ struct ocfs2_alloc_stats | |||
171 | 171 | ||
172 | enum ocfs2_local_alloc_state | 172 | enum ocfs2_local_alloc_state |
173 | { | 173 | { |
174 | OCFS2_LA_UNUSED = 0, | 174 | OCFS2_LA_UNUSED = 0, /* Local alloc will never be used for |
175 | OCFS2_LA_ENABLED, | 175 | * this mountpoint. */ |
176 | OCFS2_LA_DISABLED | 176 | OCFS2_LA_ENABLED, /* Local alloc is in use. */ |
177 | OCFS2_LA_THROTTLED, /* Local alloc is in use, but number | ||
178 | * of bits has been reduced. */ | ||
179 | OCFS2_LA_DISABLED /* Local alloc has temporarily been | ||
180 | * disabled. */ | ||
177 | }; | 181 | }; |
178 | 182 | ||
179 | enum ocfs2_mount_options | 183 | enum ocfs2_mount_options |
@@ -252,9 +256,20 @@ struct ocfs2_super | |||
252 | struct ocfs2_journal *journal; | 256 | struct ocfs2_journal *journal; |
253 | unsigned long osb_commit_interval; | 257 | unsigned long osb_commit_interval; |
254 | 258 | ||
259 | struct delayed_work la_enable_wq; | ||
260 | |||
261 | /* | ||
262 | * Must hold local alloc i_mutex and osb->osb_lock to change | ||
263 | * local_alloc_bits. Reads can be done under either lock. | ||
264 | */ | ||
255 | unsigned int local_alloc_bits; | 265 | unsigned int local_alloc_bits; |
256 | enum ocfs2_local_alloc_state local_alloc_state; | 266 | unsigned int local_alloc_default_bits; |
267 | |||
268 | enum ocfs2_local_alloc_state local_alloc_state; /* protected | ||
269 | * by osb_lock */ | ||
270 | |||
257 | struct buffer_head *local_alloc_bh; | 271 | struct buffer_head *local_alloc_bh; |
272 | |||
258 | u64 la_last_gd; | 273 | u64 la_last_gd; |
259 | 274 | ||
260 | /* Next two fields are for local node slot recovery during | 275 | /* Next two fields are for local node slot recovery during |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index d2d278fb9819..de7b93d76d12 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -111,7 +111,7 @@ static inline void ocfs2_block_to_cluster_group(struct inode *inode, | |||
111 | u64 *bg_blkno, | 111 | u64 *bg_blkno, |
112 | u16 *bg_bit_off); | 112 | u16 *bg_bit_off); |
113 | 113 | ||
114 | static void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac) | 114 | void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac) |
115 | { | 115 | { |
116 | struct inode *inode = ac->ac_inode; | 116 | struct inode *inode = ac->ac_inode; |
117 | 117 | ||
@@ -686,15 +686,6 @@ int ocfs2_reserve_clusters(struct ocfs2_super *osb, | |||
686 | if ((status < 0) && (status != -ENOSPC)) { | 686 | if ((status < 0) && (status != -ENOSPC)) { |
687 | mlog_errno(status); | 687 | mlog_errno(status); |
688 | goto bail; | 688 | goto bail; |
689 | } else if (status == -ENOSPC) { | ||
690 | /* reserve_local_bits will return enospc with | ||
691 | * the local alloc inode still locked, so we | ||
692 | * can change this safely here. */ | ||
693 | mlog(0, "Disabling local alloc\n"); | ||
694 | /* We set to OCFS2_LA_DISABLED so that umount | ||
695 | * can clean up what's left of the local | ||
696 | * allocation */ | ||
697 | osb->local_alloc_state = OCFS2_LA_DISABLED; | ||
698 | } | 689 | } |
699 | } | 690 | } |
700 | 691 | ||
@@ -1005,6 +996,7 @@ static int ocfs2_cluster_group_search(struct inode *inode, | |||
1005 | int search = -ENOSPC; | 996 | int search = -ENOSPC; |
1006 | int ret; | 997 | int ret; |
1007 | struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *) group_bh->b_data; | 998 | struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *) group_bh->b_data; |
999 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1008 | u16 tmp_off, tmp_found; | 1000 | u16 tmp_off, tmp_found; |
1009 | unsigned int max_bits, gd_cluster_off; | 1001 | unsigned int max_bits, gd_cluster_off; |
1010 | 1002 | ||
@@ -1045,6 +1037,12 @@ static int ocfs2_cluster_group_search(struct inode *inode, | |||
1045 | *bit_off = tmp_off; | 1037 | *bit_off = tmp_off; |
1046 | *bits_found = tmp_found; | 1038 | *bits_found = tmp_found; |
1047 | search = 0; /* success */ | 1039 | search = 0; /* success */ |
1040 | } else if (tmp_found) { | ||
1041 | /* | ||
1042 | * Don't show bits which we'll be returning | ||
1043 | * for allocation to the local alloc bitmap. | ||
1044 | */ | ||
1045 | ocfs2_local_alloc_seen_free_bits(osb, tmp_found); | ||
1048 | } | 1046 | } |
1049 | } | 1047 | } |
1050 | 1048 | ||
@@ -1203,9 +1201,8 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1203 | status = -ENOSPC; | 1201 | status = -ENOSPC; |
1204 | /* for now, the chain search is a bit simplistic. We just use | 1202 | /* for now, the chain search is a bit simplistic. We just use |
1205 | * the 1st group with any empty bits. */ | 1203 | * the 1st group with any empty bits. */ |
1206 | while ((status = ac->ac_group_search(alloc_inode, group_bh, | 1204 | while ((status = ac->ac_group_search(alloc_inode, group_bh, bits_wanted, |
1207 | bits_wanted, min_bits, bit_off, | 1205 | min_bits, bit_off, &tmp_bits)) == -ENOSPC) { |
1208 | &tmp_bits)) == -ENOSPC) { | ||
1209 | if (!bg->bg_next_group) | 1206 | if (!bg->bg_next_group) |
1210 | break; | 1207 | break; |
1211 | 1208 | ||
@@ -1838,9 +1835,15 @@ int ocfs2_free_clusters(handle_t *handle, | |||
1838 | status = ocfs2_free_suballoc_bits(handle, bitmap_inode, bitmap_bh, | 1835 | status = ocfs2_free_suballoc_bits(handle, bitmap_inode, bitmap_bh, |
1839 | bg_start_bit, bg_blkno, | 1836 | bg_start_bit, bg_blkno, |
1840 | num_clusters); | 1837 | num_clusters); |
1841 | if (status < 0) | 1838 | if (status < 0) { |
1842 | mlog_errno(status); | 1839 | mlog_errno(status); |
1840 | goto out; | ||
1841 | } | ||
1842 | |||
1843 | ocfs2_local_alloc_seen_free_bits(OCFS2_SB(bitmap_inode->i_sb), | ||
1844 | num_clusters); | ||
1843 | 1845 | ||
1846 | out: | ||
1844 | mlog_exit(status); | 1847 | mlog_exit(status); |
1845 | return status; | 1848 | return status; |
1846 | } | 1849 | } |
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h index 544c600662bd..40d51daf5fbc 100644 --- a/fs/ocfs2/suballoc.h +++ b/fs/ocfs2/suballoc.h | |||
@@ -147,6 +147,7 @@ static inline int ocfs2_is_cluster_bitmap(struct inode *inode) | |||
147 | * apis above. */ | 147 | * apis above. */ |
148 | int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb, | 148 | int ocfs2_reserve_cluster_bitmap_bits(struct ocfs2_super *osb, |
149 | struct ocfs2_alloc_context *ac); | 149 | struct ocfs2_alloc_context *ac); |
150 | void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac); | ||
150 | 151 | ||
151 | /* given a cluster offset, calculate which block group it belongs to | 152 | /* given a cluster offset, calculate which block group it belongs to |
152 | * and return that block offset. */ | 153 | * and return that block offset. */ |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 3dee61ebd69a..a2d3dcf70252 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -637,7 +637,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
637 | osb->s_atime_quantum = parsed_options.atime_quantum; | 637 | osb->s_atime_quantum = parsed_options.atime_quantum; |
638 | osb->preferred_slot = parsed_options.slot; | 638 | osb->preferred_slot = parsed_options.slot; |
639 | osb->osb_commit_interval = parsed_options.commit_interval; | 639 | osb->osb_commit_interval = parsed_options.commit_interval; |
640 | osb->local_alloc_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); | 640 | osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); |
641 | osb->local_alloc_bits = osb->local_alloc_default_bits; | ||
641 | 642 | ||
642 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); | 643 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); |
643 | if (status) | 644 | if (status) |
@@ -1425,6 +1426,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1425 | 1426 | ||
1426 | osb->local_alloc_state = OCFS2_LA_UNUSED; | 1427 | osb->local_alloc_state = OCFS2_LA_UNUSED; |
1427 | osb->local_alloc_bh = NULL; | 1428 | osb->local_alloc_bh = NULL; |
1429 | INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); | ||
1428 | 1430 | ||
1429 | init_waitqueue_head(&osb->osb_mount_event); | 1431 | init_waitqueue_head(&osb->osb_mount_event); |
1430 | 1432 | ||