diff mbox series

[RFC,1/6] fs: count_open_files() -> count_possible_open_files()

Message ID 20231108002647.73784-2-tycho@tycho.pizza (mailing list archive)
State New
Headers show
Series tracking fd counts per cgroup | expand

Commit Message

Tycho Andersen Nov. 8, 2023, 12:26 a.m. UTC
From: Tycho Andersen <tandersen@netflix.com>

This doesn't really count the number of open files, but the max possible
number of open files in an fd table.

In the next patch, we're going to introduce a helper to compute this number
exactly, so rename this one. (It is only called in one place, maybe we
should just inline it?)

Signed-off-by: Tycho Andersen <tandersen@netflix.com>
---
 fs/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/file.c b/fs/file.c
index 5fb0b146e79e..b1633c00bd3c 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -271,7 +271,7 @@  static inline void __clear_open_fd(unsigned int fd, struct fdtable *fdt)
 	__clear_bit(fd / BITS_PER_LONG, fdt->full_fds_bits);
 }
 
-static unsigned int count_open_files(struct fdtable *fdt)
+static unsigned int count_possible_open_files(struct fdtable *fdt)
 {
 	unsigned int size = fdt->max_fds;
 	unsigned int i;
@@ -302,7 +302,7 @@  static unsigned int sane_fdtable_size(struct fdtable *fdt, unsigned int max_fds)
 {
 	unsigned int count;
 
-	count = count_open_files(fdt);
+	count = count_possible_open_files(fdt);
 	if (max_fds < NR_OPEN_DEFAULT)
 		max_fds = NR_OPEN_DEFAULT;
 	return ALIGN(min(count, max_fds), BITS_PER_LONG);