Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp156780ybj; Fri, 8 May 2020 08:38:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLm0cwjS3GVxcEDQyZHQfmA4cEtpDny638ADSrxPb1qXPz1Q9gpMtVNrWuEYz1rTdajrkmv X-Received: by 2002:a17:906:2548:: with SMTP id j8mr2309032ejb.378.1588952339624; Fri, 08 May 2020 08:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588952339; cv=none; d=google.com; s=arc-20160816; b=ExF3M5thECdo4ktHVz1XTggEW/Ygez825MoN/HnF0fdCJvR9S3WwZ6W2hGmZ2Fb+yj pP7tndL02EOCUdy0jgjN9GBaNgd3m2UkWbGwn6/PCMCaYJwRZhqOIrVWTp2WX0TtQnMa v3CCxQrXkSBE38BaED0CpVSBd7OxYAobThpgf1Cw3ziNgTYN2IMIMCWBd9gOHMlt7vtt U/vkdm5bBLG2KzFWb0yu189MRzOMblVfqNm7AC4kcPif7PA0ei0F64GVKsik90kz3WXL y03UH3lG+AMI4064XGintqZeLS/+r2O85cPkx2eBh+532gJYgDF+0VGA8csdBDLiFwof flPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K2Uub0aVlfxersdFoVOaGQEKIhROd5F6Q0lYewfweLc=; b=BaotG6W842e1sZVVYOJRqa6oT+vPDtmUG9ArqOS7zhHQToJq7Zp18xsjjUyuLSjhQn 5vs9WbS+QwbVyPDgU6U0IL93RxZQFIPyok8A34zRcpC95y2K1Y+j9jPqTEpjh9PcPrJI hpk8/rl/xP4jep+3myKlqLvW57GT5HTEIrypPk/tJWUvNUYkA8ucGIVUsX1aqZIyKX8K sEaEuwXnvi6Qf55ti6TKB28Rfy/J0qQi2QsRG06WdF9FmZyuR5yuzL1GwhzwHVA377WC 3ZmZd6bg3rB7yP6rTukUj2zE6SvCMRmgniz/nXFMPbQer4EznG4O5I3JuWCpBq7b2gAA +zaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nLXivfej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si1249656edn.415.2020.05.08.08.38.37; Fri, 08 May 2020 08:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nLXivfej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbgEHPhC (ORCPT + 99 others); Fri, 8 May 2020 11:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgEHPg5 (ORCPT ); Fri, 8 May 2020 11:36:57 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 697C4C061A0C; Fri, 8 May 2020 08:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=K2Uub0aVlfxersdFoVOaGQEKIhROd5F6Q0lYewfweLc=; b=nLXivfejQ+u34RbuaNX/WRviAP 4MWtTgrAfbomeTARHGscIxB0QNC16PC97aZYytTP+FF+q7ACvUTThUK9PVdWxAGifmTgZugVLsN4v QY1gxUI/EnmI8tEMw9oblbdgBRg6XuLSqvnYIAcnNngOpBkkT+DiC/aonb2qvEMT37abKrQx4gHFs 7Ds+24tMuJDuoDd7QTAAiDDNyL9wAWVw2hrtUwae9zOHmIFGIc2fBYTSfQC+irX8W7GgXn0m3XJtS S1m572ziEHrm1ZsNjB4+YI+dNh4qBo0ef6X8qTK/iM60a+t/A3rmc/Rt2hlF5iujEmK4Gl4sBeDFV V4ot9Jkg==; Received: from [2001:4bb8:180:9d3f:90d7:9df8:7cd:3504] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jX53Y-0004E0-RB; Fri, 08 May 2020 15:36:57 +0000 From: Christoph Hellwig To: Alexander Viro Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 07/12] eventfd: use __anon_inode_getfd Date: Fri, 8 May 2020 17:36:29 +0200 Message-Id: <20200508153634.249933-8-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508153634.249933-1-hch@lst.de> References: <20200508153634.249933-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use __anon_inode_getfd instead of opencoding the logic using get_unused_fd_flags + anon_inode_getfile. Signed-off-by: Christoph Hellwig --- fs/eventfd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index df466ef81dddf..9b6d5137679b2 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -423,20 +423,11 @@ static int do_eventfd(unsigned int count, int flags) ctx->count = count; ctx->flags = flags; ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL); - - flags &= EFD_SHARED_FCNTL_FLAGS; - flags |= O_RDWR; - fd = get_unused_fd_flags(flags); + fd = __anon_inode_getfd("[eventfd]", &eventfd_fops, ctx, + (flags & EFD_SHARED_FCNTL_FLAGS) | O_RDWR, &file); if (fd < 0) goto err; - file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, flags); - if (IS_ERR(file)) { - put_unused_fd(fd); - fd = PTR_ERR(file); - goto err; - } - file->f_mode |= FMODE_NOWAIT; fd_install(fd, file); return fd; -- 2.26.2