[PATCH 6/8] libxfs: manage xfs_buf_zone count within cache

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

 



Fake up the xfs_buf_zone allocated count a bit to account
for buffers freed to and allocated from cache.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
---
 libxfs/rdwr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 474e5eb..c5ffd4d 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -665,6 +665,7 @@ __libxfs_getbufr(int blen)
 				free(bp->b_maps);
 			bp->b_maps = NULL;
 		}
+		xfs_buf_zone->allocated++;
 	} else
 		bp = kmem_zone_zalloc(xfs_buf_zone, 0);
 	pthread_mutex_unlock(&xfs_buf_freelist.cm_mutex);
@@ -1245,6 +1246,7 @@ libxfs_brelse(
 			"releasing dirty buffer to free list!");
 
 	pthread_mutex_lock(&xfs_buf_freelist.cm_mutex);
+	xfs_buf_zone->allocated--;
 	list_add(&bp->b_node.cn_mru, &xfs_buf_freelist.cm_list);
 	pthread_mutex_unlock(&xfs_buf_freelist.cm_mutex);
 }
@@ -1268,6 +1270,7 @@ libxfs_bulkrelse(
 	}
 
 	pthread_mutex_lock(&xfs_buf_freelist.cm_mutex);
+	xfs_buf_zone->allocated -= count;
 	list_splice(list, &xfs_buf_freelist.cm_list);
 	pthread_mutex_unlock(&xfs_buf_freelist.cm_mutex);
 
-- 
1.8.3.1

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



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux