From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035858AbdD2HnO (ORCPT ); Sat, 29 Apr 2017 03:43:14 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35721 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033716AbdD2HnE (ORCPT ); Sat, 29 Apr 2017 03:43:04 -0400 Date: Fri, 28 Apr 2017 00:39:45 +0530 From: Sandhya Bankar To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, mawmilcox@microsoft.com, keescook@chromium.org, adobriyan@gmail.com, re.emese@gmail.com, riel@surriel.com Subject: [PATCH 06/13] vfs: Remove next_fd from fd alloc code path. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The IDR is used in file descriptor allocation code to allocate new file descriptor so, no need of next_fd to track next file descriptor. Hence removing it from file descriptor allocation code path. Signed-off-by: Sandhya Bankar Signed-off-by: Matthew Wilcox --- fs/file.c | 6 ------ include/linux/fdtable.h | 1 - 2 files changed, 7 deletions(-) diff --git a/fs/file.c b/fs/file.c index 1c000d8..da3a35b 100644 --- a/fs/file.c +++ b/fs/file.c @@ -294,7 +294,6 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) idr_init(&newf->fd_idr); newf->resize_in_progress = false; init_waitqueue_head(&newf->resize_wait); - newf->next_fd = 0; new_fdt = &newf->fdtab; new_fdt->max_fds = NR_OPEN_DEFAULT; new_fdt->close_on_exec = newf->close_on_exec_init; @@ -506,9 +505,6 @@ int __alloc_fd(struct files_struct *files, goto out; } - if (start <= files->next_fd) - files->next_fd = fd + 1; - fdt = files_fdtable(files); __set_open_fd(fd, fdt); if (flags & O_CLOEXEC) @@ -538,8 +534,6 @@ static void __put_unused_fd(struct files_struct *files, unsigned int fd) { struct fdtable *fdt = files_fdtable(files); __clear_open_fd(fd, fdt); - if (fd < files->next_fd) - files->next_fd = fd; } void put_unused_fd(unsigned int fd) diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 4072f24..c2a53b6 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -58,7 +58,6 @@ struct files_struct { * written part on a separate cache line in SMP */ spinlock_t file_lock ____cacheline_aligned_in_smp; - unsigned int next_fd; unsigned long close_on_exec_init[1]; unsigned long open_fds_init[1]; unsigned long full_fds_bits_init[1]; -- 1.8.3.1