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

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

staging: lustre: osc: create cli_name to get obd name



Create the inline function cli_name() to get the name
of the OSC device.

Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5108
Reviewed-on: http://review.whamcloud.com/10458


Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bc32a0de
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -961,7 +961,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext,
	if (rc == -ETIMEDOUT) {
	if (rc == -ETIMEDOUT) {
		OSC_EXTENT_DUMP(D_ERROR, ext,
		OSC_EXTENT_DUMP(D_ERROR, ext,
				"%s: wait ext to %u timedout, recovery in progress?\n",
				"%s: wait ext to %u timedout, recovery in progress?\n",
				osc_export(obj)->exp_obd->obd_name, state);
				cli_name(osc_cli(obj)), state);


		lwi = LWI_INTR(NULL, NULL);
		lwi = LWI_INTR(NULL, NULL);
		rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state),
		rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state),
@@ -1384,7 +1384,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
	CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu "	      \
	CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu "	      \
	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d }"	      \
	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d }"	      \
	       "lru {in list: %ld, left: %ld, waiters: %d }" fmt "\n",	      \
	       "lru {in list: %ld, left: %ld, waiters: %d }" fmt "\n",	      \
	       __tmp->cl_import->imp_obd->obd_name,			      \
	       cli_name(__tmp),						      \
	       __tmp->cl_dirty_pages, __tmp->cl_dirty_max_pages,	      \
	       __tmp->cl_dirty_pages, __tmp->cl_dirty_max_pages,	      \
	       atomic_long_read(&obd_dirty_pages), obd_max_dirty_pages,	      \
	       atomic_long_read(&obd_dirty_pages), obd_max_dirty_pages,	      \
	       __tmp->cl_lost_grant, __tmp->cl_avail_grant,		      \
	       __tmp->cl_lost_grant, __tmp->cl_avail_grant,		      \
@@ -1622,7 +1622,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
		osc_io_unplug_async(env, cli, NULL);
		osc_io_unplug_async(env, cli, NULL);


		CDEBUG(D_CACHE, "%s: sleeping for cache space @ %p for %p\n",
		CDEBUG(D_CACHE, "%s: sleeping for cache space @ %p for %p\n",
		       cli->cl_import->imp_obd->obd_name, &ocw, oap);
		       cli_name(cli), &ocw, oap);


		rc = l_wait_event(ocw.ocw_waitq, ocw_granted(cli, &ocw), &lwi);
		rc = l_wait_event(ocw.ocw_waitq, ocw_granted(cli, &ocw), &lwi);


@@ -1666,7 +1666,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
		break;
		break;
	default:
	default:
		CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d, fall back to sync i/o\n",
		CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d, fall back to sync i/o\n",
		       cli->cl_import->imp_obd->obd_name, &ocw, rc);
		       cli_name(cli), &ocw, rc);
		break;
		break;
	}
	}
out:
out:
+5 −0
Original line number Original line Diff line number Diff line
@@ -155,6 +155,11 @@ static inline unsigned long rpcs_in_flight(struct client_obd *cli)
	return cli->cl_r_in_flight + cli->cl_w_in_flight;
	return cli->cl_r_in_flight + cli->cl_w_in_flight;
}
}


static inline char *cli_name(struct client_obd *cli)
{
	return cli->cl_import->imp_obd->obd_name;
}

struct osc_device {
struct osc_device {
	struct cl_device    od_cl;
	struct cl_device    od_cl;
	struct obd_export  *od_exp;
	struct obd_export  *od_exp;
+5 −7
Original line number Original line Diff line number Diff line
@@ -385,7 +385,7 @@ int lru_queue_work(const struct lu_env *env, void *data)
{
{
	struct client_obd *cli = data;
	struct client_obd *cli = data;


	CDEBUG(D_CACHE, "Run LRU work for client obd %p.\n", cli);
	CDEBUG(D_CACHE, "%s: run LRU work for client obd\n", cli_name(cli));


	if (osc_cache_too_much(cli))
	if (osc_cache_too_much(cli))
		osc_lru_shrink(env, cli, lru_shrink_max, true);
		osc_lru_shrink(env, cli, lru_shrink_max, true);
@@ -675,8 +675,7 @@ long osc_lru_reclaim(struct client_obd *cli)
	}
	}


	CDEBUG(D_CACHE, "%s: cli %p no free slots, pages: %ld, busy: %ld.\n",
	CDEBUG(D_CACHE, "%s: cli %p no free slots, pages: %ld, busy: %ld.\n",
	       cli->cl_import->imp_obd->obd_name, cli,
	       cli_name(cli), cli, atomic_long_read(&cli->cl_lru_in_list),
	       atomic_long_read(&cli->cl_lru_in_list),
	       atomic_long_read(&cli->cl_lru_busy));
	       atomic_long_read(&cli->cl_lru_busy));


	/* Reclaim LRU slots from other client_obd as it can't free enough
	/* Reclaim LRU slots from other client_obd as it can't free enough
@@ -694,7 +693,7 @@ long osc_lru_reclaim(struct client_obd *cli)
				 cl_lru_osc);
				 cl_lru_osc);


		CDEBUG(D_CACHE, "%s: cli %p LRU pages: %ld, busy: %ld.\n",
		CDEBUG(D_CACHE, "%s: cli %p LRU pages: %ld, busy: %ld.\n",
		       cli->cl_import->imp_obd->obd_name, cli,
		       cli_name(cli), cli,
		       atomic_long_read(&cli->cl_lru_in_list),
		       atomic_long_read(&cli->cl_lru_in_list),
		       atomic_long_read(&cli->cl_lru_busy));
		       atomic_long_read(&cli->cl_lru_busy));


@@ -714,7 +713,7 @@ long osc_lru_reclaim(struct client_obd *cli)
out:
out:
	cl_env_put(env, &refcheck);
	cl_env_put(env, &refcheck);
	CDEBUG(D_CACHE, "%s: cli %p freed %ld pages.\n",
	CDEBUG(D_CACHE, "%s: cli %p freed %ld pages.\n",
	       cli->cl_import->imp_obd->obd_name, cli, rc);
	       cli_name(cli), cli, rc);
	return rc;
	return rc;
}
}


@@ -903,8 +902,7 @@ bool osc_over_unstable_soft_limit(struct client_obd *cli)


	CDEBUG(D_CACHE,
	CDEBUG(D_CACHE,
	       "%s: cli: %p unstable pages: %lu, osc unstable pages: %lu\n",
	       "%s: cli: %p unstable pages: %lu, osc unstable pages: %lu\n",
	       cli->cl_import->imp_obd->obd_name, cli,
	       cli_name(cli), cli, unstable_nr, osc_unstable_count);
	       unstable_nr, osc_unstable_count);


	/*
	/*
	 * If the LRU slots are in shortage - 25% remaining AND this OSC
	 * If the LRU slots are in shortage - 25% remaining AND this OSC
+2 −2
Original line number Original line Diff line number Diff line
@@ -106,7 +106,7 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
			}
			}


			CDEBUG(D_QUOTA, "%s: setdq to insert for %s %d (%d)\n",
			CDEBUG(D_QUOTA, "%s: setdq to insert for %s %d (%d)\n",
			       cli->cl_import->imp_obd->obd_name,
			       cli_name(cli),
			       type == USRQUOTA ? "user" : "group",
			       type == USRQUOTA ? "user" : "group",
			       qid[type], rc);
			       qid[type], rc);
		} else {
		} else {
@@ -122,7 +122,7 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
				kmem_cache_free(osc_quota_kmem, oqi);
				kmem_cache_free(osc_quota_kmem, oqi);


			CDEBUG(D_QUOTA, "%s: setdq to remove for %s %d (%p)\n",
			CDEBUG(D_QUOTA, "%s: setdq to remove for %s %d (%p)\n",
			       cli->cl_import->imp_obd->obd_name,
			       cli_name(cli),
			       type == USRQUOTA ? "user" : "group",
			       type == USRQUOTA ? "user" : "group",
			       qid[type], oqi);
			       qid[type], oqi);
		}
		}
+5 −8
Original line number Original line Diff line number Diff line
@@ -589,8 +589,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
		 * this CERROR() unless we add in a small fudge factor (+1).
		 * this CERROR() unless we add in a small fudge factor (+1).
		 */
		 */
		CERROR("%s: dirty %ld + %ld > system dirty_max %lu\n",
		CERROR("%s: dirty %ld + %ld > system dirty_max %lu\n",
		       cli->cl_import->imp_obd->obd_name,
		       cli_name(cli), atomic_long_read(&obd_dirty_pages),
		       atomic_long_read(&obd_dirty_pages),
		       atomic_long_read(&obd_dirty_transit_pages),
		       atomic_long_read(&obd_dirty_transit_pages),
		       obd_max_dirty_pages);
		       obd_max_dirty_pages);
		oa->o_undirty = 0;
		oa->o_undirty = 0;
@@ -785,12 +784,10 @@ static int osc_add_shrink_grant(struct client_obd *client)
				       osc_grant_shrink_grant_cb, NULL,
				       osc_grant_shrink_grant_cb, NULL,
				       &client->cl_grant_shrink_list);
				       &client->cl_grant_shrink_list);
	if (rc) {
	if (rc) {
		CERROR("add grant client %s error %d\n",
		CERROR("add grant client %s error %d\n", cli_name(client), rc);
		       client->cl_import->imp_obd->obd_name, rc);
		return rc;
		return rc;
	}
	}
	CDEBUG(D_CACHE, "add grant client %s\n",
	CDEBUG(D_CACHE, "add grant client %s\n", cli_name(client));
	       client->cl_import->imp_obd->obd_name);
	osc_update_next_shrink(client);
	osc_update_next_shrink(client);
	return 0;
	return 0;
}
}
@@ -824,8 +821,8 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd)
	spin_unlock(&cli->cl_loi_list_lock);
	spin_unlock(&cli->cl_loi_list_lock);


	CDEBUG(D_CACHE, "%s, setting cl_avail_grant: %ld cl_lost_grant: %ld chunk bits: %d\n",
	CDEBUG(D_CACHE, "%s, setting cl_avail_grant: %ld cl_lost_grant: %ld chunk bits: %d\n",
	       cli->cl_import->imp_obd->obd_name,
	       cli_name(cli), cli->cl_avail_grant, cli->cl_lost_grant,
	       cli->cl_avail_grant, cli->cl_lost_grant, cli->cl_chunkbits);
	       cli->cl_chunkbits);


	if (ocd->ocd_connect_flags & OBD_CONNECT_GRANT_SHRINK &&
	if (ocd->ocd_connect_flags & OBD_CONNECT_GRANT_SHRINK &&
	    list_empty(&cli->cl_grant_shrink_list))
	    list_empty(&cli->cl_grant_shrink_list))