@@ -99,25 +99,6 @@ static inline void inc_frontswap_invalidates(void) { }
99
99
*/
100
100
void frontswap_register_ops (struct frontswap_ops * ops )
101
101
{
102
- DECLARE_BITMAP (a , MAX_SWAPFILES );
103
- DECLARE_BITMAP (b , MAX_SWAPFILES );
104
- struct swap_info_struct * si ;
105
- unsigned int i ;
106
-
107
- bitmap_zero (a , MAX_SWAPFILES );
108
- bitmap_zero (b , MAX_SWAPFILES );
109
-
110
- spin_lock (& swap_lock );
111
- plist_for_each_entry (si , & swap_active_head , list ) {
112
- if (!WARN_ON (!si -> frontswap_map ))
113
- __set_bit (si -> type , a );
114
- }
115
- spin_unlock (& swap_lock );
116
-
117
- /* the new ops needs to know the currently active swap devices */
118
- for_each_set_bit (i , a , MAX_SWAPFILES )
119
- ops -> init (i );
120
-
121
102
/*
122
103
* Setting frontswap_ops must happen after the ops->init() calls
123
104
* above; cmpxchg implies smp_mb() which will ensure the init is
@@ -128,28 +109,6 @@ void frontswap_register_ops(struct frontswap_ops *ops)
128
109
} while (cmpxchg (& frontswap_ops , ops -> next , ops ) != ops -> next );
129
110
130
111
static_branch_inc (& frontswap_enabled_key );
131
-
132
- spin_lock (& swap_lock );
133
- plist_for_each_entry (si , & swap_active_head , list ) {
134
- if (si -> frontswap_map )
135
- __set_bit (si -> type , b );
136
- }
137
- spin_unlock (& swap_lock );
138
-
139
- /*
140
- * On the very unlikely chance that a swap device was added or
141
- * removed between setting the "a" list bits and the ops init
142
- * calls, we re-check and do init or invalidate for any changed
143
- * bits.
144
- */
145
- if (unlikely (!bitmap_equal (a , b , MAX_SWAPFILES ))) {
146
- for (i = 0 ; i < MAX_SWAPFILES ; i ++ ) {
147
- if (!test_bit (i , a ) && test_bit (i , b ))
148
- ops -> init (i );
149
- else if (test_bit (i , a ) && !test_bit (i , b ))
150
- ops -> invalidate_area (i );
151
- }
152
- }
153
112
}
154
113
155
114
/*
0 commit comments