Lines Matching refs:t
28 int bit_map_string_get(struct bit_map *t, int len, int align) in bit_map_string_get() argument
35 if (t->num_colors) { in bit_map_string_get()
38 align = t->num_colors; in bit_map_string_get()
47 if (align < 0 || align >= t->size) in bit_map_string_get()
49 if (len <= 0 || len > t->size) in bit_map_string_get()
53 spin_lock(&t->lock); in bit_map_string_get()
54 if (len < t->last_size) in bit_map_string_get()
55 offset = t->first_free; in bit_map_string_get()
57 offset = t->last_off & ~align1; in bit_map_string_get()
60 off_new = find_next_zero_bit(t->map, t->size, offset); in bit_map_string_get()
64 if (offset >= t->size) in bit_map_string_get()
66 if (count + len > t->size) { in bit_map_string_get()
67 spin_unlock(&t->lock); in bit_map_string_get()
70 t->size, t->used, offset, len, align, count); in bit_map_string_get()
74 if (offset + len > t->size) { in bit_map_string_get()
75 count += t->size - offset; in bit_map_string_get()
81 while (test_bit(offset + i, t->map) == 0) { in bit_map_string_get()
84 bitmap_set(t->map, offset, len); in bit_map_string_get()
85 if (offset == t->first_free) in bit_map_string_get()
86 t->first_free = find_next_zero_bit in bit_map_string_get()
87 (t->map, t->size, in bit_map_string_get()
88 t->first_free + len); in bit_map_string_get()
89 if ((t->last_off = offset + len) >= t->size) in bit_map_string_get()
90 t->last_off = 0; in bit_map_string_get()
91 t->used += len; in bit_map_string_get()
92 t->last_size = len; in bit_map_string_get()
93 spin_unlock(&t->lock); in bit_map_string_get()
98 if ((offset += i + 1) >= t->size) in bit_map_string_get()
103 void bit_map_clear(struct bit_map *t, int offset, int len) in bit_map_clear() argument
107 if (t->used < len) in bit_map_clear()
109 spin_lock(&t->lock); in bit_map_clear()
111 if (test_bit(offset + i, t->map) == 0) in bit_map_clear()
113 __clear_bit(offset + i, t->map); in bit_map_clear()
115 if (offset < t->first_free) in bit_map_clear()
116 t->first_free = offset; in bit_map_clear()
117 t->used -= len; in bit_map_clear()
118 spin_unlock(&t->lock); in bit_map_clear()
121 void bit_map_init(struct bit_map *t, unsigned long *map, int size) in bit_map_init() argument
124 memset(t, 0, sizeof *t); in bit_map_init()
125 spin_lock_init(&t->lock); in bit_map_init()
126 t->map = map; in bit_map_init()
127 t->size = size; in bit_map_init()