Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f6cc9ab authored by Peng Tao's avatar Peng Tao Committed by Greg Kroah-Hartman
Browse files

staging/lustre: replace num_physpages with totalram_pages



The global variable num_physpages is going away. Replace it
with totalram_pages.

Cc: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b2f64d0
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -63,9 +63,9 @@
#if BITS_PER_LONG == 32
#if BITS_PER_LONG == 32
/* limit to lowmem on 32-bit systems */
/* limit to lowmem on 32-bit systems */
#define NUM_CACHEPAGES \
#define NUM_CACHEPAGES \
	min(num_physpages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
	min(totalram_pages, 1UL << (30 - PAGE_CACHE_SHIFT) * 3 / 4)
#else
#else
#define NUM_CACHEPAGES num_physpages
#define NUM_CACHEPAGES totalram_pages
#endif
#endif


/*
/*
+5 −5
Original line number Original line Diff line number Diff line
@@ -339,8 +339,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
	cli->cl_avail_grant = 0;
	cli->cl_avail_grant = 0;
	/* FIXME: Should limit this for the sum of all cl_dirty_max. */
	/* FIXME: Should limit this for the sum of all cl_dirty_max. */
	cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024;
	cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024;
	if (cli->cl_dirty_max >> PAGE_CACHE_SHIFT > num_physpages / 8)
	if (cli->cl_dirty_max >> PAGE_CACHE_SHIFT > totalram_pages / 8)
		cli->cl_dirty_max = num_physpages << (PAGE_CACHE_SHIFT - 3);
		cli->cl_dirty_max = totalram_pages << (PAGE_CACHE_SHIFT - 3);
	INIT_LIST_HEAD(&cli->cl_cache_waiters);
	INIT_LIST_HEAD(&cli->cl_cache_waiters);
	INIT_LIST_HEAD(&cli->cl_loi_ready_list);
	INIT_LIST_HEAD(&cli->cl_loi_ready_list);
	INIT_LIST_HEAD(&cli->cl_loi_hp_ready_list);
	INIT_LIST_HEAD(&cli->cl_loi_hp_ready_list);
@@ -388,11 +388,11 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)


	if (!strcmp(name, LUSTRE_MDC_NAME)) {
	if (!strcmp(name, LUSTRE_MDC_NAME)) {
		cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
		cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 128 /* MB */) {
	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 128 /* MB */) {
		cli->cl_max_rpcs_in_flight = 2;
		cli->cl_max_rpcs_in_flight = 2;
	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 256 /* MB */) {
	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 256 /* MB */) {
		cli->cl_max_rpcs_in_flight = 3;
		cli->cl_max_rpcs_in_flight = 3;
	} else if (num_physpages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
	} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
		cli->cl_max_rpcs_in_flight = 4;
		cli->cl_max_rpcs_in_flight = 4;
	} else {
	} else {
		if (osc_on_mdt(obddev->obd_name))
		if (osc_on_mdt(obddev->obd_name))
+1 −1
Original line number Original line Diff line number Diff line
@@ -269,7 +269,7 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask,


int cfs_trace_max_debug_mb(void)
int cfs_trace_max_debug_mb(void)
{
{
	int  total_mb = (num_physpages >> (20 - PAGE_SHIFT));
	int  total_mb = (totalram_pages >> (20 - PAGE_SHIFT));


	return MAX(512, (total_mb * 80)/100);
	return MAX(512, (total_mb * 80)/100);
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -243,9 +243,9 @@ static ssize_t ll_max_readahead_mb_seq_write(struct file *file, const char *buff
	if (rc)
	if (rc)
		return rc;
		return rc;


	if (pages_number < 0 || pages_number > num_physpages / 2) {
	if (pages_number < 0 || pages_number > totalram_pages / 2) {
		CERROR("can't set file readahead more than %lu MB\n",
		CERROR("can't set file readahead more than %lu MB\n",
		       num_physpages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/
		       totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/
		return -ERANGE;
		return -ERANGE;
	}
	}


@@ -388,10 +388,10 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, const char *buffer,
	if (rc)
	if (rc)
		RETURN(rc);
		RETURN(rc);


	if (pages_number < 0 || pages_number > num_physpages) {
	if (pages_number < 0 || pages_number > totalram_pages) {
		CERROR("%s: can't set max cache more than %lu MB\n",
		CERROR("%s: can't set max cache more than %lu MB\n",
		       ll_get_fsname(sb, NULL, 0),
		       ll_get_fsname(sb, NULL, 0),
		       num_physpages >> (20 - PAGE_CACHE_SHIFT));
		       totalram_pages >> (20 - PAGE_CACHE_SHIFT));
		RETURN(-ERANGE);
		RETURN(-ERANGE);
	}
	}


+3 −3
Original line number Original line Diff line number Diff line
@@ -558,10 +558,10 @@ static int __init init_obdclass(void)
	/* Default the dirty page cache cap to 1/2 of system memory.
	/* Default the dirty page cache cap to 1/2 of system memory.
	 * For clients with less memory, a larger fraction is needed
	 * For clients with less memory, a larger fraction is needed
	 * for other purposes (mostly for BGL). */
	 * for other purposes (mostly for BGL). */
	if (num_physpages <= 512 << (20 - PAGE_CACHE_SHIFT))
	if (totalram_pages <= 512 << (20 - PAGE_CACHE_SHIFT))
		obd_max_dirty_pages = num_physpages / 4;
		obd_max_dirty_pages = totalram_pages / 4;
	else
	else
		obd_max_dirty_pages = num_physpages / 2;
		obd_max_dirty_pages = totalram_pages / 2;


	err = obd_init_caches();
	err = obd_init_caches();
	if (err)
	if (err)
Loading