diff options
| -rw-r--r-- | fs/block_dev.c | 23 | ||||
| -rw-r--r-- | fs/proc/proc_misc.c | 4 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 2 | ||||
| -rw-r--r-- | mm/page_alloc.c | 3 |
4 files changed, 29 insertions, 3 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index f5a3d314bcd4..9b20fd7b9f52 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -332,6 +332,29 @@ struct block_device *bdget(dev_t dev) return bdev; } +long nr_blockdev_pages(void) +{ + long ret = 0; + int i; + + spin_lock(&bdev_lock); + for (i = 0; i < ARRAY_SIZE(bdev_hashtable); i++) { + struct list_head *head = &bdev_hashtable[i]; + struct list_head *lh; + + if (head == NULL) + continue; + list_for_each(lh, head) { + struct block_device *bdev; + + bdev = list_entry(lh, struct block_device, bd_hash); + ret += bdev->bd_inode->i_mapping->nrpages; + } + } + spin_unlock(&bdev_lock); + return ret; +} + static inline void __bd_forget(struct inode *inode) { list_del_init(&inode->i_devices); diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 5bf8dbc9d871..8e75f1f9a57c 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -165,6 +165,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, "MemTotal: %8lu kB\n" "MemFree: %8lu kB\n" "MemShared: %8lu kB\n" + "Buffers: %8lu kB\n" "Cached: %8lu kB\n" "SwapCached: %8lu kB\n" "Active: %8lu kB\n" @@ -185,7 +186,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, K(i.totalram), K(i.freeram), K(i.sharedram), - K(ps.nr_pagecache-swapper_space.nrpages), + K(i.bufferram), + K(ps.nr_pagecache-swapper_space.nrpages-i.bufferram), K(swapper_space.nrpages), K(active), K(inactive), diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7ef082f9462f..70781c985caa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -327,7 +327,7 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); extern void generic_unplug_device(void *); - +extern long nr_blockdev_pages(void); /* * tag stuff diff --git a/mm/page_alloc.c b/mm/page_alloc.c index fdf25f60d93f..7a85123602ad 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -23,6 +23,7 @@ #include <linux/module.h> #include <linux/suspend.h> #include <linux/pagevec.h> +#include <linux/blkdev.h> unsigned long totalram_pages; unsigned long totalhigh_pages; @@ -589,7 +590,7 @@ void si_meminfo(struct sysinfo *val) val->totalram = totalram_pages; val->sharedram = 0; val->freeram = nr_free_pages(); - val->bufferram = get_page_cache_size(); + val->bufferram = nr_blockdev_pages(); #ifdef CONFIG_HIGHMEM val->totalhigh = totalhigh_pages; val->freehigh = nr_free_highpages(); |
