Commit 2579d8d0 authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman
Browse files

staging/lustre/osc: to drop LRU pages with cl_lru_work

parent 5196e42c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -364,6 +364,7 @@ struct client_obd {

	/* ptlrpc work for writeback in ptlrpcd context */
	void		    *cl_writeback_work;
	void			*cl_lru_work;
	/* hash tables for osc_quota_info */
	struct cfs_hash	      *cl_quota_hash[MAXQUOTAS];
};
+8 −1
Original line number Diff line number Diff line
@@ -393,6 +393,8 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,
	struct super_block *sb = ((struct seq_file *)file->private_data)->private;
	struct ll_sb_info *sbi = ll_s2sbi(sb);
	struct cl_client_cache *cache = &sbi->ll_cache;
	struct lu_env *env;
	int refcheck;
	int mult, rc, pages_number;
	int diff = 0;
	int nrpages = 0;
@@ -430,6 +432,10 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,
		goto out;
	}

	env = cl_env_get(&refcheck);
	if (IS_ERR(env))
		return 0;

	diff = -diff;
	while (diff > 0) {
		int tmp;
@@ -461,13 +467,14 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,

		/* difficult - have to ask OSCs to drop LRU slots. */
		tmp = diff << 1;
		rc = obd_set_info_async(NULL, sbi->ll_dt_exp,
		rc = obd_set_info_async(env, sbi->ll_dt_exp,
					sizeof(KEY_CACHE_LRU_SHRINK),
					KEY_CACHE_LRU_SHRINK,
					sizeof(tmp), &tmp, NULL);
		if (rc < 0)
			break;
	}
	cl_env_put(env, &refcheck);

out:
	if (rc >= 0) {
+10 −2
Original line number Diff line number Diff line
@@ -222,8 +222,16 @@ static ssize_t osc_cached_mb_seq_write(struct file *file,
		return -ERANGE;

	rc = atomic_read(&cli->cl_lru_in_list) - pages_number;
	if (rc > 0)
		(void)osc_lru_shrink(cli, rc, true);
	if (rc > 0) {
		struct lu_env *env;
		int refcheck;

		env = cl_env_get(&refcheck);
		if (!IS_ERR(env)) {
			(void)osc_lru_shrink(env, cli, rc, true);
			cl_env_put(env, &refcheck);
		}
	}

	return count;
}
+1 −0
Original line number Diff line number Diff line
@@ -457,6 +457,7 @@ int osc_cache_wait_range(const struct lu_env *env, struct osc_object *obj,
			 pgoff_t start, pgoff_t end);
void osc_io_unplug(const struct lu_env *env, struct client_obd *cli,
		   struct osc_object *osc);
int lru_queue_work(const struct lu_env *env, void *data);

void osc_object_set_contended  (struct osc_object *obj);
void osc_object_clear_contended(struct osc_object *obj);
+2 −1
Original line number Diff line number Diff line
@@ -130,7 +130,8 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *cfg);
int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
		  struct list_head *ext_list, int cmd);
int osc_lru_shrink(struct client_obd *cli, int target, bool force);
int osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
		   int target, bool force);
int osc_lru_reclaim(struct client_obd *cli);

extern spinlock_t osc_ast_guard;
Loading