From patchwork Thu Aug 9 02:04:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10560697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1214E14E5 for ; Thu, 9 Aug 2018 02:08:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED1C42AC8F for ; Thu, 9 Aug 2018 02:07:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E15672AC95; Thu, 9 Aug 2018 02:07:59 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 9B4642AC8F for ; Thu, 9 Aug 2018 02:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727805AbeHIEaS (ORCPT ); Thu, 9 Aug 2018 00:30:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:60590 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725757AbeHIEaS (ORCPT ); Thu, 9 Aug 2018 00:30:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3A05AACE8; Thu, 9 Aug 2018 02:07:54 +0000 (UTC) From: NeilBrown To: Jeff Layton , Alexander Viro Date: Thu, 09 Aug 2018 12:04:41 +1000 Subject: [PATCH 4/5] fs/locks: split out __locks_wake_one() Cc: "J. Bruce Fields" , Martin Wilck , linux-fsdevel@vger.kernel.org, Frank Filz , linux-kernel@vger.kernel.org Message-ID: <153378028117.1220.6771440459821567385.stgit@noble> In-Reply-To: <153378012255.1220.6754153662007899557.stgit@noble> References: <153378012255.1220.6754153662007899557.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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 This functionality will be useful in the next patch, so split it out from __locks_wake_up_blocks(). Signed-off-by: NeilBrown --- fs/locks.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index d06658b2dc7a..fc64016d01ee 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -710,6 +710,15 @@ static void __locks_delete_block(struct file_lock *waiter) waiter->fl_blocker = NULL; } +static void __locks_wake_one(struct file_lock *waiter) +{ + __locks_delete_block(waiter); + if (waiter->fl_lmops && waiter->fl_lmops->lm_notify) + waiter->fl_lmops->lm_notify(waiter); + else + wake_up(&waiter->fl_wait); +} + static void __locks_wake_up_blocks(struct file_lock *blocker) { while (!list_empty(&blocker->fl_blocked)) { @@ -717,11 +726,7 @@ static void __locks_wake_up_blocks(struct file_lock *blocker) waiter = list_first_entry(&blocker->fl_blocked, struct file_lock, fl_block); - __locks_delete_block(waiter); - if (waiter->fl_lmops && waiter->fl_lmops->lm_notify) - waiter->fl_lmops->lm_notify(waiter); - else - wake_up(&waiter->fl_wait); + __locks_wake_one(waiter); } }