From: Sandhya Bankar <bankarsandhya512@gmail.com>
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.
Date: Fri, 28 Apr 2017 00:39:45 +0530 [thread overview]
Message-ID: <fb8b775f007e3997dcbe50f10b3e541cc035b11f.1493315290.git.bankarsandhya512@gmail.com> (raw)
In-Reply-To: <cover.1493315288.git.bankarsandhya512@gmail.com>
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 <bankarsandhya512@gmail.com>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
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
next prev parent reply other threads:[~2017-04-29 7:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 18:48 [PATCH 00/13] vfs: Convert file allocation code to use the IDR Sandhya Bankar
2017-04-27 18:54 ` [PATCH 01/13] idr: Add ability to set/clear tags Matthew Wilcox
2017-04-27 19:05 ` [PATCH 02/13] idr: Add idr_for_each_entry_tagged() Sandhya Bankar
2017-04-27 19:06 ` [PATCH 03/13] idr, radix-tree: Add get_tag_batch function Sandhya Bankar
2017-04-27 19:07 ` [PATCH 04/13] idr, radix-tree: Implement copy_preload Sandhya Bankar
2017-04-27 19:08 ` [PATCH 05/13] vfs: Replace array of file pointers with an IDR Sandhya Bankar
2017-10-04 15:45 ` [RESEND PATCH " Mateusz Guzik
2017-04-27 19:09 ` Sandhya Bankar [this message]
2017-04-27 19:10 ` [PATCH 07/13] vfs: Remove full_fds_bits from fd allocation code path Sandhya Bankar
2017-04-27 19:11 ` [PATCH 08/13] vfs: Use idr_tag_get() in fd_is_open() Sandhya Bankar
2017-04-27 19:12 ` [PATCH 09/13] vfs: Rewrite close_files() Sandhya Bankar
2017-04-27 19:14 ` [PATCH 10/13] vfs: Replace close_on_exec bitmap with an IDR tag Sandhya Bankar
2017-04-27 19:17 ` [PATCH 11/13] vfs: Add init_task.h include Sandhya Bankar
2017-04-27 19:18 ` [PATCH 12/13] vfs: Convert select to use idr_get_tag_batch() Sandhya Bankar
2017-04-27 19:19 ` [PATCH 13/13] vfs: Delete struct fdtable Sandhya Bankar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb8b775f007e3997dcbe50f10b3e541cc035b11f.1493315290.git.bankarsandhya512@gmail.com \
--to=bankarsandhya512@gmail.com \
--cc=adobriyan@gmail.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mawmilcox@microsoft.com \
--cc=re.emese@gmail.com \
--cc=riel@surriel.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®