From patchwork Thu Jan 8 18:34:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 5595241 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4CAEDC058D for ; Thu, 8 Jan 2015 18:39:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2DFB20439 for ; Thu, 8 Jan 2015 18:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBB0220430 for ; Thu, 8 Jan 2015 18:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757374AbbAHSjU (ORCPT ); Thu, 8 Jan 2015 13:39:20 -0500 Received: from mail-qc0-f175.google.com ([209.85.216.175]:55104 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755086AbbAHSeo (ORCPT ); Thu, 8 Jan 2015 13:34:44 -0500 Received: by mail-qc0-f175.google.com with SMTP id p6so3689258qcv.6 for ; Thu, 08 Jan 2015 10:34:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rpoAqL1/HOzSJuH/4r0FXSXwZ889UjqtjwSzu2tLRWo=; b=MDtCC78t455t8ZT7dotLznF9oR45FqZNlg8+0TX08Sp892YMaRxCLy8PmX4D6NAkqa IkdPtHCvcwaX+ctKU/sSoTt/vjDjzlbLQncKOJmkt+PtauysHRBs++9KqdswFBM7U+o/ y/ME9Ozy5baS2N2ddkG7SfMmTApx0N1IVYH+0RGqzKUKS1s6o133p9Fu0u2fYiSp8aUD l8hOVZ7T9tY+3iTa6Gp31g5aTL64ZLYy1/ZQUB+5Mf9SJoJzv/TApN7UYDQXtLc2O+nD efjzvI9THB3ZSb1YUJC5LGC4eEKFXJ6gFHqAesW823lEWFBy/ge4NvmeS3dd5M88Ci/1 kuGA== X-Gm-Message-State: ALoCoQnd/yR6lAX3l6KqVb4uD+vwSm6kn/ClzV/DCUD918tfrDD/jzSADc1+JAkPcGt0c/GyfQe1 X-Received: by 10.224.57.142 with SMTP id c14mr18189803qah.103.1420742083054; Thu, 08 Jan 2015 10:34:43 -0800 (PST) Received: from synchrony.poochiereds.net ([50.242.95.105]) by mx.google.com with ESMTPSA id 7sm4708739qak.20.2015.01.08.10.34.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jan 2015 10:34:42 -0800 (PST) From: Jeff Layton To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, hch@infradead.org Subject: [PATCH v2 01/10] locks: add new struct list_head to struct file_lock Date: Thu, 8 Jan 2015 10:34:16 -0800 Message-Id: <1420742065-28423-2-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420742065-28423-1-git-send-email-jlayton@primarydata.com> References: <1420742065-28423-1-git-send-email-jlayton@primarydata.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ...that we can use to queue file_locks to per-ctx list_heads. Go ahead and convert locks_delete_lock and locks_dispose_list to use it instead of the fl_block list. Signed-off-by: Jeff Layton --- fs/locks.c | 8 +++++--- include/linux/fs.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index 735b8d3fa78c..fba8bc7af6d3 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -207,6 +207,7 @@ static struct kmem_cache *filelock_cache __read_mostly; static void locks_init_lock_heads(struct file_lock *fl) { INIT_HLIST_NODE(&fl->fl_link); + INIT_LIST_HEAD(&fl->fl_list); INIT_LIST_HEAD(&fl->fl_block); init_waitqueue_head(&fl->fl_wait); } @@ -243,6 +244,7 @@ EXPORT_SYMBOL_GPL(locks_release_private); void locks_free_lock(struct file_lock *fl) { BUG_ON(waitqueue_active(&fl->fl_wait)); + BUG_ON(!list_empty(&fl->fl_list)); BUG_ON(!list_empty(&fl->fl_block)); BUG_ON(!hlist_unhashed(&fl->fl_link)); @@ -257,8 +259,8 @@ locks_dispose_list(struct list_head *dispose) struct file_lock *fl; while (!list_empty(dispose)) { - fl = list_first_entry(dispose, struct file_lock, fl_block); - list_del_init(&fl->fl_block); + fl = list_first_entry(dispose, struct file_lock, fl_list); + list_del_init(&fl->fl_list); locks_free_lock(fl); } } @@ -691,7 +693,7 @@ static void locks_delete_lock(struct file_lock **thisfl_p, locks_unlink_lock(thisfl_p); if (dispose) - list_add(&fl->fl_block, dispose); + list_add(&fl->fl_list, dispose); else locks_free_lock(fl); } diff --git a/include/linux/fs.h b/include/linux/fs.h index f90c0282c114..9eee7200cfe3 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -934,6 +934,7 @@ int locks_in_grace(struct net *); */ struct file_lock { struct file_lock *fl_next; /* singly linked list for this inode */ + struct list_head fl_list; /* link into file_lock_context */ struct hlist_node fl_link; /* node in global lists */ struct list_head fl_block; /* circular list of blocked processes */ fl_owner_t fl_owner;