io_uring: Add register support for non-4k PAGE_SIZE
authorwangyangbo <wangyangbo@uniontech.com>
Thu, 19 Aug 2021 05:56:57 +0000 (13:56 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 23 Aug 2021 19:10:46 +0000 (13:10 -0600)
Now allocated rsrc table uses PAGE_SIZE as the size of 2nd-level, and
accessing this table relies on each level index from fixed TABLE_SHIFT
(12 - 3) in 4k page case. In order to correctly work in non-4k page,
define TABLE_SHIFT as non-fixed (PAGE_SHIFT - shift of data) for
2nd-level table entry number.

Signed-off-by: wangyangbo <wangyangbo@uniontech.com>
Link: https://lore.kernel.org/r/20210819055657.27327-1-wangyangbo@uniontech.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 9107cd7..5d3df4f 100644 (file)
 #define IORING_MAX_CQ_ENTRIES  (2 * IORING_MAX_ENTRIES)
 #define IORING_SQPOLL_CAP_ENTRIES_VALUE 8
 
-/* 512 entries per page on 64-bit archs, 64 pages max */
+/* only define max */
 #define IORING_MAX_FIXED_FILES (1U << 15)
 #define IORING_MAX_RESTRICTIONS        (IORING_RESTRICTION_LAST + \
                                 IORING_REGISTER_LAST + IORING_OP_LAST)
 
-#define IO_RSRC_TAG_TABLE_SHIFT        9
+#define IO_RSRC_TAG_TABLE_SHIFT        (PAGE_SHIFT - 3)
 #define IO_RSRC_TAG_TABLE_MAX  (1U << IO_RSRC_TAG_TABLE_SHIFT)
 #define IO_RSRC_TAG_TABLE_MASK (IO_RSRC_TAG_TABLE_MAX - 1)