From patchwork Tue Jun 7 17:31:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Rees X-Patchwork-Id: 858372 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p57HV9tq013288 for ; Tue, 7 Jun 2011 17:31:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756664Ab1FGRb1 (ORCPT ); Tue, 7 Jun 2011 13:31:27 -0400 Received: from int-mailstore01.merit.edu ([207.75.116.232]:51044 "EHLO int-mailstore01.merit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067Ab1FGRb1 (ORCPT ); Tue, 7 Jun 2011 13:31:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by int-mailstore01.merit.edu (Postfix) with ESMTP id CE6633083A6D; Tue, 7 Jun 2011 13:31:26 -0400 (EDT) X-Virus-Scanned: amavisd-new at int-mailstore01.merit.edu Received: from int-mailstore01.merit.edu ([127.0.0.1]) by localhost (int-mailstore01.merit.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H80nLWK+ekzR; Tue, 7 Jun 2011 13:31:26 -0400 (EDT) Received: from merit.edu (host-17.subnet-17.med.umich.edu [141.214.17.17]) by int-mailstore01.merit.edu (Postfix) with ESMTPSA id 41E203055B74; Tue, 7 Jun 2011 13:31:26 -0400 (EDT) Date: Tue, 7 Jun 2011 13:31:24 -0400 From: Jim Rees To: Benny Halevy Cc: linux-nfs@vger.kernel.org, peter honeyman Subject: [PATCH 45/88] SQUASHME: pnfsblock: Implement release_inval_marks Message-ID: <12097a1c787be91438d2afedde71a72f95a61665.1307464382.git.rees@umich.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 07 Jun 2011 17:31:28 +0000 (UTC) From: Zhang Jingwang Leaving it unimplemented will cause memory leak. Signed-off-by: Zhang Jingwang Signed-off-by: Benny Halevy --- fs/nfs/blocklayout/blocklayout.c | 11 ++++++++--- fs/nfs/blocklayout/blocklayout.h | 6 ++++++ fs/nfs/blocklayout/extents.c | 6 ------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index db008e6..b0ad836 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -541,10 +541,15 @@ release_extents(struct pnfs_block_layout *bl, spin_unlock(&bl->bl_ext_lock); } -/* STUB */ static void -release_inval_marks(void) +release_inval_marks(struct pnfs_inval_markings *marks) { + struct pnfs_inval_tracking *pos, *temp; + + list_for_each_entry_safe(pos, temp, &marks->im_tree.mtt_stub, it_link) { + list_del(&pos->it_link); + kfree(pos); + } return; } @@ -556,7 +561,7 @@ bl_free_layout(void *p) dprintk("%s enter\n", __func__); release_extents(bl, NULL); - release_inval_marks(); + release_inval_marks(&bl->bl_inval); kfree(bl); return; } diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h index ca36e61..45939e1 100644 --- a/fs/nfs/blocklayout/blocklayout.h +++ b/fs/nfs/blocklayout/blocklayout.h @@ -126,6 +126,12 @@ struct pnfs_inval_markings { sector_t im_block_size; /* Server blocksize in sectors */ }; +struct pnfs_inval_tracking { + struct list_head it_link; + int it_sector; + int it_tags; +}; + /* sector_t fields are all in 512-byte sectors */ struct pnfs_block_extent { struct kref be_refcnt; diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c index 4722899..cf5b3a3 100644 --- a/fs/nfs/blocklayout/extents.c +++ b/fs/nfs/blocklayout/extents.c @@ -40,12 +40,6 @@ #define INTERNAL_EXISTS MY_MAX_TAGS #define INTERNAL_MASK ((1 << INTERNAL_EXISTS) - 1) -struct pnfs_inval_tracking { - struct list_head it_link; - int it_sector; - int it_tags; -}; - /* Returns largest t<=s s.t. t%base==0 */ static inline sector_t normalize(sector_t s, int base) {