From patchwork Thu Apr 27 19:18:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandhya Bankar X-Patchwork-Id: 9705721 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 82B3C602BE for ; Sat, 29 Apr 2017 07:51:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7000528668 for ; Sat, 29 Apr 2017 07:51:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62FC128684; Sat, 29 Apr 2017 07:51:34 +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.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_HI 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 2019028668 for ; Sat, 29 Apr 2017 07:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2999886AbdD2Hvc (ORCPT ); Sat, 29 Apr 2017 03:51:32 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35580 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967553AbdD2HvR (ORCPT ); Sat, 29 Apr 2017 03:51:17 -0400 Received: by mail-pf0-f193.google.com with SMTP id o68so1521858pfj.2; Sat, 29 Apr 2017 00:51:17 -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=WxLCsN6FJaOq+nUzuJR1xwjdgIRrKwGCY/7b0qCWTLI=; b=hvaiMskL3MokX0ulbTBlejqhH6S3cQ9Jf7lcuyNWqI5ZxEuENhDe/pprkaY9qh34c3 pgPUOYs11MqMe+R0f2UH8Svl9QMwPJUVOy969v8GU3ixFWkQQnh3+Y7IXrDZieDRKCvq 1tSgisvDVbVgVUFKqfFJJBV+NxCpc4Wg4P4/y2Zs3Pbcsws0KEXL+XmA4jjGdnTwt6ib Y+rkp+PsjbA8N8I1jMBccuqsMn7XhPU74cauDtE4SEGz+KuHXgCheZaFuSngnKMatujh Kcu2ehKdURySBCvfi8CXLEgyDGBEJ0/POi5k15gROF33lDKpz2OIxnJbhZ6UHbX23/yi XlTw== 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=WxLCsN6FJaOq+nUzuJR1xwjdgIRrKwGCY/7b0qCWTLI=; b=ggIgNvC3B9TvIwgjFpelr0yFH5D6U/RzkRnIAEv4DkywPZpb0Z0kBLMoi64GQ5ESrl PEXQoweOxz68aLfKGdUQCb7Nstfb+XgvcUWm4eMRub544c923kgbiq2DUPX6Yt5hEaOQ i6jvQ6nV8Zu1xcHtZc/q9AlILroIv8CDf2NGVyDFfFynfwJjp31YCKwtukC2JCJdoX1D jQrwU7cw5ZeSPTOJt5m8LFwW8OBNE4QHqTB4xQ3K1AOHZjTLjsHzixJuGizoFZEhU8EL BiNyhe4RNs00KDwNGF27FbleQeCP3cescv4L5dZ+HbRrRODDIyxJ4L07wSC++qS/oRD+ WttA== X-Gm-Message-State: AN3rC/4qwszBNESkH+ZZhyRtl5SVWG16QgAfObbU3uH+5JSsoicWVU0z RCXEQhIci36GbA== X-Received: by 10.84.222.129 with SMTP id x1mr20413976pls.44.1493452275637; Sat, 29 Apr 2017 00:51:15 -0700 (PDT) Received: from localhost.localdomain ([223.229.187.11]) by smtp.gmail.com with ESMTPSA id m29sm15383910pfj.32.2017.04.29.00.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Apr 2017 00:51:15 -0700 (PDT) Date: Fri, 28 Apr 2017 00:48:38 +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 12/13] vfs: Convert select to use idr_get_tag_batch() Message-ID: <95215e24f0724f9a16b0ad6ea8ee1b9a070d133b.1493315290.git.bankarsandhya512@gmail.com> 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 Convert select to use idr_get_tag_batch(). Signed-off-by: Sandhya Bankar Signed-off-by: Matthew Wilcox --- 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;