From patchwork Thu Apr 27 19:09:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandhya Bankar X-Patchwork-Id: 9705695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4E5FE602BE for ; Sat, 29 Apr 2017 07:43:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A0B328671 for ; Sat, 29 Apr 2017 07:43:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B49628681; Sat, 29 Apr 2017 07:43:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFC3728671 for ; Sat, 29 Apr 2017 07:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165204AbdD2HnF (ORCPT ); Sat, 29 Apr 2017 03:43:05 -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 Received: by mail-pf0-f194.google.com with SMTP id o68so1501285pfj.2; Sat, 29 Apr 2017 00:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZuVF6E5fe5uqWZyD4G7Xa5jcjl9HPSShB4AGTy61GzE=; b=YUFPgUkdsONAIBnVUHOuGQjDcdwI0dbqUPxNLS4jAXY+hw7cHZ+ZA5b3gfnlS1Wk3R EKU68UPIvs4A0cEsaS1XlMcQArwoalIeaHpHZjChuTEnFu+ksnlSxGq0bAp+F4sGF5sE 2b63lAUhcSr+7XXDWZN7ZMZGrkZ84NWA/sIQi67ZJPk8DTbOhmaEXNg//3DTMWVEc3Mi shJNvECKRuBfaNO+vK17Ri4qMe8RqwfFXEHPOJ23yBPUfwVLlSgxVo7SViwQWjy0Ftri Ez60wZJIJxdLw3+Wf89mUBlnT+pz/GPjUxRaQxwFmb1tqEZvE63ooX0kmQsp6V49LYHC 7ghg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZuVF6E5fe5uqWZyD4G7Xa5jcjl9HPSShB4AGTy61GzE=; b=WIcnt1GTLv4rwOXE+Q6+YeBwFtrQzR2Ug7UjZIMPXOjvF3ny+4vHHMNZMWkOlBD+HQ DNyOZh4BcYQCbqW6rNElihrj88j7VY+8lnunxE5xEnLEx7Qm250zb5KTD3r4YFYiJYee amPtmH0EDyNNVIEAvPySmMKtuL+EkpWQyGcw3CY+LbhI+PZYbPPEPL2nDi/IAeoPnV3p UmFXfihcwT4SzDcFfiNZIoN7+PotBKS4Sq5UFKdyvWEtqcWNDW2yBjyVWH83SEUohx2c nAAoi4aGGWxlo41mLf9QP+t5V/jghTpxhbwZ4zTaDGXzGaXm2Dle6I5iVsn0OmB5rgYM 1Rkw== X-Gm-Message-State: AN3rC/5owLZHVLZ04TxaAZMvT6SGUZTY/1DMApzoRakZ2IOmwsUheZuV K9c7zfkZGvzfNg== X-Received: by 10.99.3.18 with SMTP id 18mr15838957pgd.105.1493451783354; Sat, 29 Apr 2017 00:43:03 -0700 (PDT) Received: from localhost.localdomain ([223.229.187.11]) by smtp.gmail.com with ESMTPSA id q70sm19519131pgq.45.2017.04.29.00.42.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Apr 2017 00:43:02 -0700 (PDT) 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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];