@@ -146,28 +146,6 @@ struct io_overflow_cqe {
146146 struct io_uring_cqe cqe ;
147147};
148148
149- /*
150- * FFS_SCM is only available on 64-bit archs, for 32-bit we just define it as 0
151- * and define IO_URING_SCM_ALL. For this case, we use SCM for all files as we
152- * can't safely always dereference the file when the task has exited and ring
153- * cleanup is done. If a file is tracked and part of SCM, then unix gc on
154- * process exit may reap it before __io_sqe_files_unregister() is run.
155- */
156- #define FFS_NOWAIT 0x1UL
157- #define FFS_ISREG 0x2UL
158- #if defined(CONFIG_64BIT )
159- #define FFS_SCM 0x4UL
160- #else
161- #define IO_URING_SCM_ALL
162- #define FFS_SCM 0x0UL
163- #endif
164- #define FFS_MASK ~(FFS_NOWAIT|FFS_ISREG|FFS_SCM)
165-
166- struct io_fixed_file {
167- /* file * with additional FFS_* flags */
168- unsigned long file_ptr ;
169- };
170-
171149struct io_rsrc_put {
172150 struct list_head list ;
173151 u64 tag ;
@@ -3983,27 +3961,6 @@ static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
39833961 return __io_openat_prep (req , sqe );
39843962}
39853963
3986- static int io_file_bitmap_get (struct io_ring_ctx * ctx )
3987- {
3988- struct io_file_table * table = & ctx -> file_table ;
3989- unsigned long nr = ctx -> nr_user_files ;
3990- int ret ;
3991-
3992- do {
3993- ret = find_next_zero_bit (table -> bitmap , nr , table -> alloc_hint );
3994- if (ret != nr )
3995- return ret ;
3996-
3997- if (!table -> alloc_hint )
3998- break ;
3999-
4000- nr = table -> alloc_hint ;
4001- table -> alloc_hint = 0 ;
4002- } while (1 );
4003-
4004- return - ENFILE ;
4005- }
4006-
40073964/*
40083965 * Note when io_fixed_fd_install() returns error value, it will ensure
40093966 * fput() is called correspondingly.
@@ -6832,12 +6789,6 @@ static void io_wq_submit_work(struct io_wq_work *work)
68326789 io_req_task_queue_fail (req , ret );
68336790}
68346791
6835- static inline struct io_fixed_file * io_fixed_file_slot (struct io_file_table * table ,
6836- unsigned i )
6837- {
6838- return & table -> files [i ];
6839- }
6840-
68416792static inline struct file * io_file_from_index (struct io_ring_ctx * ctx ,
68426793 int index )
68436794{
@@ -7934,43 +7885,6 @@ static __cold int io_rsrc_data_alloc(struct io_ring_ctx *ctx, rsrc_put_fn *do_pu
79347885 return ret ;
79357886}
79367887
7937- static bool io_alloc_file_tables (struct io_file_table * table , unsigned nr_files )
7938- {
7939- table -> files = kvcalloc (nr_files , sizeof (table -> files [0 ]),
7940- GFP_KERNEL_ACCOUNT );
7941- if (unlikely (!table -> files ))
7942- return false;
7943-
7944- table -> bitmap = bitmap_zalloc (nr_files , GFP_KERNEL_ACCOUNT );
7945- if (unlikely (!table -> bitmap )) {
7946- kvfree (table -> files );
7947- return false;
7948- }
7949-
7950- return true;
7951- }
7952-
7953- static void io_free_file_tables (struct io_file_table * table )
7954- {
7955- kvfree (table -> files );
7956- bitmap_free (table -> bitmap );
7957- table -> files = NULL ;
7958- table -> bitmap = NULL ;
7959- }
7960-
7961- static inline void io_file_bitmap_set (struct io_file_table * table , int bit )
7962- {
7963- WARN_ON_ONCE (test_bit (bit , table -> bitmap ));
7964- __set_bit (bit , table -> bitmap );
7965- table -> alloc_hint = bit + 1 ;
7966- }
7967-
7968- static inline void io_file_bitmap_clear (struct io_file_table * table , int bit )
7969- {
7970- __clear_bit (bit , table -> bitmap );
7971- table -> alloc_hint = bit ;
7972- }
7973-
79747888static void __io_sqe_files_unregister (struct io_ring_ctx * ctx )
79757889{
79767890#if !defined(IO_URING_SCM_ALL )
0 commit comments