Skip to content

Commit 29d2214

Browse files
Hou TaoKernel Patches Daemon
authored andcommitted
bpf: Remove unused helpers for map-in-map
bpf_map_fd_put_ptr() and bpf_map_fd_sys_lookup_elem() are no longer used for map-in-map, so just remove these two helpers. bpf_map_fd_get_ptr() is only used internally, so make it be static. Signed-off-by: Hou Tao <[email protected]>
1 parent 67dfb25 commit 29d2214

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

kernel/bpf/map_in_map.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0,
106106
btf_record_equal(meta0->record, meta1->record);
107107
}
108108

109-
void *bpf_map_fd_get_ptr(struct bpf_map *map,
110-
struct file *map_file /* not used */,
111-
int ufd)
109+
static void *bpf_map_fd_get_ptr(struct bpf_map *map, int ufd)
112110
{
113111
struct bpf_map *inner_map, *inner_map_meta;
114112
struct fd f;
@@ -128,19 +126,6 @@ void *bpf_map_fd_get_ptr(struct bpf_map *map,
128126
return inner_map;
129127
}
130128

131-
void bpf_map_fd_put_ptr(void *ptr, bool deferred)
132-
{
133-
/* ptr->ops->map_free() has to go through one
134-
* rcu grace period by itself.
135-
*/
136-
bpf_map_put(ptr);
137-
}
138-
139-
u32 bpf_map_fd_sys_lookup_elem(void *ptr)
140-
{
141-
return ((struct bpf_map *)ptr)->id;
142-
}
143-
144129
void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file,
145130
int ufd)
146131
{
@@ -151,7 +136,7 @@ void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file,
151136
if (!element)
152137
return ERR_PTR(-ENOMEM);
153138

154-
inner_map = bpf_map_fd_get_ptr(map, map_file, ufd);
139+
inner_map = bpf_map_fd_get_ptr(map, ufd);
155140
if (IS_ERR(inner_map)) {
156141
kfree(element);
157142
return inner_map;

kernel/bpf/map_in_map.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ struct bpf_inner_map_element {
1919

2020
struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd);
2121
void bpf_map_meta_free(struct bpf_map *map_meta);
22-
void *bpf_map_fd_get_ptr(struct bpf_map *map, struct file *map_file, int ufd);
23-
void bpf_map_fd_put_ptr(void *ptr, bool need_defer);
24-
u32 bpf_map_fd_sys_lookup_elem(void *ptr);
2522

2623
void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file, int ufd);
2724
void bpf_map_of_map_fd_put_ptr(void *ptr, bool need_defer);

0 commit comments

Comments
 (0)