From patchwork Tue Aug 19 15:16:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4743961 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6942BC0338 for ; Tue, 19 Aug 2014 15:17:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9BA120115 for ; Tue, 19 Aug 2014 15:17:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C84820155 for ; Tue, 19 Aug 2014 15:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753095AbaHSPQ5 (ORCPT ); Tue, 19 Aug 2014 11:16:57 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:51932 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbaHSPQ4 (ORCPT ); Tue, 19 Aug 2014 11:16:56 -0400 Received: by mail-pa0-f43.google.com with SMTP id lf10so10197082pab.16 for ; Tue, 19 Aug 2014 08:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=2yZ6YhkijEGBJf6q7hbyTNSEbb1u8tJqNupFjjOpDUc=; b=T+r7MBaFe1bcMAwrAdOVCoalnET1kFwY07cgO1Ep3u8lOxqDuwTtPv2Obz/OjUbYpI KF/DwDO8hXqgdfxScq4AwnnZRuJwDBJrBPeENYwzcpkSSQ9gPgATey/4uMXQ78MAGPHu 9e4gC01zS9u1vGHxdvp7c+USf7A2LGodVR9XfMQHDM93uD69Cy6aa6/XmQOfiSukjqVQ 0ynZTOu48TEoQKzUB97F4TuNUzWBcuzunOolaQeL2QEYXgzZ/Z6JQIKG90u3sSFDIhvh Af81ubRmXP6/+89ko3yiBKo7yy5M30skBcnh58Vb2I/Vx25uGrmUa/pRbmMDeIT3NJEC vTsQ== X-Received: by 10.68.57.175 with SMTP id j15mr14226124pbq.164.1408461412966; Tue, 19 Aug 2014 08:16:52 -0700 (PDT) Received: from [192.168.0.100] ([118.117.110.46]) by mx.google.com with ESMTPSA id cd15sm7012634pac.30.2014.08.19.08.16.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2014 08:16:51 -0700 (PDT) Message-ID: <53F36A4C.60301@gmail.com> Date: Tue, 19 Aug 2014 23:16:28 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Jeff Layton CC: "J. Bruce Fields" , Linux NFS Mailing List , Trond Myklebust , linux-fsdevel@vger.kernel.org, kinglongmee@gmail.com Subject: [PATCH 1/6 v4] NFSD: Remove the duplicate initialize of file_lock References: <53BAAAC5.9000106@gmail.com> <53E22EA5.70708@gmail.com> <20140809065112.700e0ecc@tlielax.poochiereds.net> <53E791F1.40802@gmail.com> <53ED5093.6000308@gmail.com> In-Reply-To: <53ED5093.6000308@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 locks_alloc_lock() has initialize the struct file_lock, so, don't need re-initialize it by locks_init_lock(). v4: same as v3, only cleanup Signed-off-by: Kinglong Mee Reviewed-by: Jeff Layton Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4state.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2e80a59..98edf97 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3759,7 +3759,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_file *fp, int flag) fl = locks_alloc_lock(); if (!fl) return NULL; - locks_init_lock(fl); fl->fl_lmops = &nfsd_lease_mng_ops; fl->fl_flags = FL_DELEG; fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK; @@ -5210,7 +5209,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, } fp = lock_stp->st_stid.sc_file; - locks_init_lock(file_lock); switch (lock->lk_type) { case NFS4_READ_LT: case NFS4_READW_LT: @@ -5354,7 +5352,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_jukebox; goto out; } - locks_init_lock(file_lock); + switch (lockt->lt_type) { case NFS4_READ_LT: case NFS4_READW_LT: @@ -5432,7 +5430,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfserr_jukebox; goto fput; } - locks_init_lock(file_lock); + file_lock->fl_type = F_UNLCK; file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner); file_lock->fl_pid = current->tgid;