.. | .. |
---|
59 | 59 | static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, |
---|
60 | 60 | u32 index, int offset, struct bio *bio); |
---|
61 | 61 | |
---|
62 | | -#ifdef CONFIG_PREEMPT_RT |
---|
63 | | -static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) |
---|
64 | | -{ |
---|
65 | | - size_t index; |
---|
66 | | - |
---|
67 | | - for (index = 0; index < num_pages; index++) |
---|
68 | | - spin_lock_init(&zram->table[index].lock); |
---|
69 | | -} |
---|
70 | | - |
---|
71 | | -static int zram_slot_trylock(struct zram *zram, u32 index) |
---|
72 | | -{ |
---|
73 | | - int ret; |
---|
74 | | - |
---|
75 | | - ret = spin_trylock(&zram->table[index].lock); |
---|
76 | | - if (ret) |
---|
77 | | - __set_bit(ZRAM_LOCK, &zram->table[index].flags); |
---|
78 | | - return ret; |
---|
79 | | -} |
---|
80 | | - |
---|
81 | | -static void zram_slot_lock(struct zram *zram, u32 index) |
---|
82 | | -{ |
---|
83 | | - spin_lock(&zram->table[index].lock); |
---|
84 | | - __set_bit(ZRAM_LOCK, &zram->table[index].flags); |
---|
85 | | -} |
---|
86 | | - |
---|
87 | | -static void zram_slot_unlock(struct zram *zram, u32 index) |
---|
88 | | -{ |
---|
89 | | - __clear_bit(ZRAM_LOCK, &zram->table[index].flags); |
---|
90 | | - spin_unlock(&zram->table[index].lock); |
---|
91 | | -} |
---|
92 | | - |
---|
93 | | -#else |
---|
94 | | - |
---|
95 | | -static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) { } |
---|
96 | 62 | |
---|
97 | 63 | static int zram_slot_trylock(struct zram *zram, u32 index) |
---|
98 | 64 | { |
---|
.. | .. |
---|
108 | 74 | { |
---|
109 | 75 | bit_spin_unlock(ZRAM_LOCK, &zram->table[index].flags); |
---|
110 | 76 | } |
---|
111 | | -#endif |
---|
112 | 77 | |
---|
113 | 78 | static inline bool init_done(struct zram *zram) |
---|
114 | 79 | { |
---|
.. | .. |
---|
1213 | 1178 | |
---|
1214 | 1179 | if (!huge_class_size) |
---|
1215 | 1180 | huge_class_size = zs_huge_class_size(zram->mem_pool); |
---|
1216 | | - zram_meta_init_table_locks(zram, num_pages); |
---|
1217 | 1181 | return true; |
---|
1218 | 1182 | } |
---|
1219 | 1183 | |
---|