Skip to content

Commit bb21da0

Browse files
Song ChenKernel Patches Daemon
authored andcommitted
kernel/bpf/syscall: use IS_FD_HASH in bpf_map_update_value
If IS_FD_HASH is defined on the top of the file, then use it to replace "map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS". Signed-off-by: Song Chen <[email protected]>
1 parent 78417cf commit bb21da0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/bpf/syscall.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ static void maybe_wait_bpf_programs(struct bpf_map *map)
156156
* time can be very long and userspace may think it will hang forever,
157157
* so don't handle sleepable BPF programs now.
158158
*/
159-
if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS ||
160-
map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
159+
if (IS_FD_HASH(map) || map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
161160
synchronize_rcu();
162161
}
163162

@@ -276,7 +275,7 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
276275
} else if (IS_FD_ARRAY(map)) {
277276
err = bpf_fd_array_map_update_elem(map, map_file, key, value,
278277
flags);
279-
} else if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS) {
278+
} else if (IS_FD_HASH(map)) {
280279
err = bpf_fd_htab_map_update_elem(map, map_file, key, value,
281280
flags);
282281
} else if (map->map_type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY) {

0 commit comments

Comments
 (0)