From patchwork Fri Feb 24 15:43:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 9590779 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 B55B8601AE for ; Fri, 24 Feb 2017 16:41:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8131D28741 for ; Fri, 24 Feb 2017 16:41:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75F0028755; Fri, 24 Feb 2017 16:41:27 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 3796228741 for ; Fri, 24 Feb 2017 16:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751291AbdBXQl0 (ORCPT ); Fri, 24 Feb 2017 11:41:26 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58668 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751268AbdBXQlS (ORCPT ); Fri, 24 Feb 2017 11:41:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=G/JmWOlfC7AMNL9k6eIxJIDIfOPL/IoWqYG0vuWeEUQ=; b=ZqRLZUb1iC49pxvzCLmiDfh3Nk MPzim06rPmSwuithZnWZZxVq2DcM0C9Mle7pJXzREa7cqD95c0efSVT/Ldg0gGGxHpyq3dpDvZE1T vOosjyOCeJF0Tyux13IEDAtKGaAPSucmrzvOhA7oR1OAJ4+pOFA4TC9tCenPVIl4fMXU788e/UsOj FlkU427ZXGnh8LxwocRbVD9hqCLb3zNg+rDZBqRa/TOntRQ5bK0wrjM0bZKn+bOA4AbpIwPwy0HqP AcV7TKfeFN3ao5udAJLJAF8IRP3O6yM/d4pER14glY6FgwSXmJnSKZWDEvU2hRfOI3NpuuQ9hTdR0 uZSzy6/w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=twins.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1chItY-0004OG-EF; Fri, 24 Feb 2017 16:39:00 +0000 Received: by twins.programming.kicks-ass.net (Postfix, from userid 0) id E061210295A9E; Fri, 24 Feb 2017 17:39:03 +0100 (CET) Message-Id: <20170224162043.922049726@infradead.org> User-Agent: quilt/0.63-1 Date: Fri, 24 Feb 2017 16:43:30 +0100 From: Peter Zijlstra To: Al Viro , Linus Torvalds , Chris Mason Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Howells , elena.reshetova@intel.com, ishkamiel@gmail.com, dwindsor@gmail.com, gregkh@linuxfoundation.org, peterz@infradead.org Subject: [RFC][PATCH 01/10] fs: Use lockdep_assert_held() instead of comments References: <20170224154329.478276481@infradead.org> MIME-Version: 1.0 Content-Disposition: inline; filename=peterz-fs-inode-1.patch 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 Because nobody reads comments... Signed-off-by: Peter Zijlstra (Intel) --- fs/inode.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/fs/inode.c +++ b/fs/inode.c @@ -384,11 +384,9 @@ static void init_once(void *foo) inode_init_once(inode); } -/* - * inode->i_lock must be held - */ void __iget(struct inode *inode) { + lockdep_assert_held(&inode->i_lock); atomic_inc(&inode->i_count); } @@ -409,11 +407,10 @@ static void inode_lru_list_add(struct in /* * Add inode to LRU if needed (inode is unused and clean). - * - * Needs inode->i_lock held. */ void inode_add_lru(struct inode *inode) { + lockdep_assert_held(&inode->i_lock); if (!(inode->i_state & (I_DIRTY_ALL | I_SYNC | I_FREEING | I_WILL_FREE)) && !atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE)