diff mbox series

[1/3] fs: Use get_max_files() instead of files_stat.max_files in alloc_empty_file()

Message ID 1591425140-20613-1-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
State New, archived
Headers show
Series [1/3] fs: Use get_max_files() instead of files_stat.max_files in alloc_empty_file() | expand

Commit Message

Tiezhu Yang June 6, 2020, 6:32 a.m. UTC
It is better to use get_max_files() instead of files_stat.max_files
to improve readability.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 fs/file_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/file_table.c b/fs/file_table.c
index 656647f..26516d0 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -139,12 +139,12 @@  struct file *alloc_empty_file(int flags, const struct cred *cred)
 	/*
 	 * Privileged users can go above max_files
 	 */
-	if (get_nr_files() >= files_stat.max_files && !capable(CAP_SYS_ADMIN)) {
+	if (get_nr_files() >= get_max_files() && !capable(CAP_SYS_ADMIN)) {
 		/*
 		 * percpu_counters are inaccurate.  Do an expensive check before
 		 * we go and fail.
 		 */
-		if (percpu_counter_sum_positive(&nr_files) >= files_stat.max_files)
+		if (percpu_counter_sum_positive(&nr_files) >= get_max_files())
 			goto over;
 	}