[PATCH 45/88] SQUASHME: pnfsblock: Implement release_inval_marks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhang Jingwang <zhangjingwang@xxxxxxxxxxxx>

Leaving it unimplemented will cause memory leak.

Signed-off-by: Zhang Jingwang <zhangjingwang@xxxxxxxxxxxx>
Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
---
 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)
 {
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux