lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 07/20] lustre: lov: prefer mirrors on non-rotational OSTs
Date: Mon, 11 Oct 2021 13:40:36 -0400	[thread overview]
Message-ID: <1633974049-26490-8-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1633974049-26490-1-git-send-email-jsimmons@infradead.org>

From: Alex Zhuravlev <bzzz@whamcloud.com>

consider non-rotational OSTs as preferred unless explicit prefer
flag is set on a mirror.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14996
Lustre-commit: 8507472dd37ebc07 ("LU-14996 lov: prefer mirrors on non-rotational OSTs")
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44883
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lov/lov_cl_internal.h |  5 +++--
 fs/lustre/lov/lov_object.c      | 26 ++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/fs/lustre/lov/lov_cl_internal.h b/fs/lustre/lov/lov_cl_internal.h
index 7fcc327..d48e2df3 100644
--- a/fs/lustre/lov/lov_cl_internal.h
+++ b/fs/lustre/lov/lov_cl_internal.h
@@ -225,6 +225,7 @@ struct lov_layout_dom {
 struct lov_layout_entry {
 	u32					lle_type;
 	unsigned int				lle_valid:1;
+	unsigned int				lle_preference;
 	struct lu_extent			*lle_extent;
 	struct lov_stripe_md_entry		*lle_lsme;
 	struct lov_comp_layout_entry_ops	*lle_comp_ops;
@@ -236,12 +237,12 @@ struct lov_layout_entry {
 
 struct lov_mirror_entry {
 	unsigned short	lre_mirror_id;
-	unsigned short	lre_preferred:1,
-			lre_stale:1,	/* set if any components is stale */
+	unsigned short	lre_stale:1,	/* set if any components is stale */
 			lre_valid:1,	/* set if at least one of components
 					 * in this mirror is valid
 					 */
 			lre_foreign:1;	/* set if it is a foreign component */
+	int		lre_preference;	/* overall preference of this mirror */
 
 	unsigned short	lre_start;	/* index to lo_entries, start index of
 					 * this mirror
diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c
index 16fed09..ff0f7fa 100644
--- a/fs/lustre/lov/lov_object.c
+++ b/fs/lustre/lov/lov_object.c
@@ -234,6 +234,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
 		struct lov_oinfo *oinfo = lse->lsme_oinfo[i];
 		int ost_idx = oinfo->loi_ost_idx;
 		struct cl_device *subdev;
+		struct obd_export *exp;
 
 		if (lov_oinfo_is_dummy(oinfo))
 			continue;
@@ -250,6 +251,13 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
 			goto out;
 		}
 
+		exp = dev->ld_lov->lov_tgts[ost_idx]->ltd_exp;
+		if (likely(exp)) {
+			/* the more fast OSTs the better */
+			if (exp->exp_obd->obd_osfs.os_state & OS_STATFS_NONROT)
+				lle->lle_preference++;
+		}
+
 		subdev = lovsub2cl_dev(dev->ld_target[ost_idx]);
 		subconf->u.coc_oinfo = oinfo;
 		LASSERTF(subdev, "not init ost %d\n", ost_idx);
@@ -621,7 +629,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
 	unsigned int mirror_count;
 	int result = 0;
 	unsigned int seq;
-	int i, j;
+	int i, j, preference;
 	bool dom_size = 0;
 
 	LASSERT(lsm->lsm_entry_count > 0);
@@ -661,6 +669,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
 
 		lle->lle_lsme = lsm->lsm_entries[i];
 		lle->lle_type = lov_entry_type(lle->lle_lsme);
+		lle->lle_preference = 0;
 		switch (lle->lle_type) {
 		case LOV_PATTERN_RAID0:
 			lle->lle_comp_ops = &raid0_ops;
@@ -722,8 +731,8 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
 		/* entries must be sorted by mirrors */
 		lre->lre_mirror_id = mirror_id;
 		lre->lre_start = lre->lre_end = i;
-		lre->lre_preferred = !!(lle->lle_lsme->lsme_flags &
-					LCME_FL_PREF_RD);
+		lre->lre_preference = lle->lle_lsme->lsme_flags &
+					LCME_FL_PREF_RD ? 1000 : 0;
 		lre->lre_valid = lle->lle_valid;
 		lre->lre_stale = !lle->lle_valid;
 		lre->lre_foreign = lsme_is_foreign(lle->lle_lsme);
@@ -771,6 +780,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
 	 * so that different clients would use different mirrors for read.
 	 */
 	mirror_count = 0;
+	preference = -1;
 	seq = hash_long((unsigned long)lov, 8);
 	for (i = 0; i < comp->lo_mirror_count; i++) {
 		unsigned int idx = (i + seq) % comp->lo_mirror_count;
@@ -784,8 +794,16 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
 
 		mirror_count++; /* valid mirror */
 
-		if (lre->lre_preferred || comp->lo_preferred_mirror < 0)
+		/* aggregated preference of all involved OSTs */
+		for (j = lre->lre_start; j <= lre->lre_end; j++) {
+			lre->lre_preference +=
+				comp->lo_entries[j].lle_preference;
+		}
+
+		if (lre->lre_preference > preference) {
+			preference = lre->lre_preference;
 			comp->lo_preferred_mirror = idx;
+		}
 	}
 	if (!mirror_count) {
 		CDEBUG(D_INODE, DFID
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2021-10-11 17:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 17:40 [lustre-devel] [PATCH 00/20] lustre: sync to OpenSFS Oct 11, 2021 James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 01/20] lustre: nfs: don't store parent fid James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 02/20] lustre: sec: filename encryption - symlink support James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 03/20] lustre: llite: support fallocate() on selected mirror James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 04/20] lustre: llite: move env contexts to ll_inode_info level James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 05/20] lustre: sec: do not expose security.c to listxattr/getxattr James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 06/20] lustre: brw: log T10 GRD tags during checksum calcs James Simmons
2021-10-11 17:40 ` James Simmons [this message]
2021-10-11 17:40 ` [lustre-devel] [PATCH 08/20] lustre: sec: access to enc file's xattrs James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 09/20] lustre: update version to 2.14.55 James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 10/20] lustre: osc: Do not attempt sending empty pages James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 11/20] lustre: ptlrpc: handle reply and resend reorder James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 12/20] lustre: ptlrpc: use wait_woken() in ptlrpcd() James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 13/20] lustre: quota: fix quota with root squash enabled James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 14/20] lustre: llite: harden ll_sbi ll_flags James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 15/20] lustre: osc: use original cli for osc_lru_reclaim for debug msg James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 16/20] lustre: obdclass: lu_ref_add() called in atomic context James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 17/20] lnet: Ensure round robin selection of local NIs James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 18/20] lnet: Ensure round robin selection of peer NIs James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 19/20] lustre: mdc: update max_easize on reconnect James Simmons
2021-10-11 17:40 ` [lustre-devel] [PATCH 20/20] lnet: include linux/ethtool.h James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1633974049-26490-8-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).