[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <95215e24f0724f9a16b0ad6ea8ee1b9a070d133b.1493315290.git.bankarsandhya512@gmail.com>
Date: Tue, 11 Jul 2017 19:06:33 +0530
From: Sandhya Bankar <bankarsandhya512@...il.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
viro@...iv.linux.org.uk, mawilcox@...rosoft.com,
keescook@...omium.org, adobriyan@...il.com, re.emese@...il.com,
riel@...riel.com
Subject: [RESEND PATCH 12/13] vfs: Convert select to use idr_get_tag_batch()
Convert select to use idr_get_tag_batch().
Signed-off-by: Sandhya Bankar <bankarsandhya512@...il.com>
Signed-off-by: Matthew Wilcox <mawilcox@...rosoft.com>
---
fs/select.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index e211227..5d20a14 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -346,32 +346,33 @@ static int poll_select_copy_remaining(struct timespec64 *end_time,
static int max_select_fd(unsigned long n, fd_set_bits *fds)
{
- unsigned long *open_fds;
+ unsigned long bad_fds;
unsigned long set;
int max;
- struct fdtable *fdt;
+ struct idr *fd_idr = ¤t->files->fd_idr;
/* handle last in-complete long-word first */
set = ~(~0UL << (n & (BITS_PER_LONG-1)));
n /= BITS_PER_LONG;
- fdt = files_fdtable(current->files);
- open_fds = fdt->open_fds + n;
max = 0;
if (set) {
set &= BITS(fds, n);
if (set) {
- if (!(set & ~*open_fds))
+ bad_fds = idr_get_tag_batch(fd_idr, (n * BITS_PER_LONG),
+ IDR_FREE);
+ if (!(set & bad_fds))
goto get_max;
return -EBADF;
}
}
while (n) {
- open_fds--;
n--;
set = BITS(fds, n);
if (!set)
continue;
- if (set & ~*open_fds)
+ bad_fds = idr_get_tag_batch(fd_idr, (n * BITS_PER_LONG),
+ IDR_FREE);
+ if (set & bad_fds)
return -EBADF;
if (max)
continue;
--
1.8.3.1
Powered by blists - more mailing lists