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: Yang Sheng <ys@whamcloud.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 7/9] lustre: obdclass: add option %H for jobid
Date: Mon,  8 Feb 2021 19:54:25 -0500	[thread overview]
Message-ID: <1612832067-1449-8-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1612832067-1449-1-git-send-email-jsimmons@infradead.org>

From: Yang Sheng <ys@whamcloud.com>

Add a option %H to avoid jobid too long in some cases.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14339
Lustre-commit: cf72ee174bbf7e6 ("LU-14339 obdclass: add option %H for jobid")
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41262
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/jobid.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/fs/lustre/obdclass/jobid.c b/fs/lustre/obdclass/jobid.c
index 3ee9d40..52ba398 100644
--- a/fs/lustre/obdclass/jobid.c
+++ b/fs/lustre/obdclass/jobid.c
@@ -206,6 +206,7 @@ static void jobid_prune_expedite(void)
  *   %e = executable
  *   %g = gid
  *   %h = hostname
+ *   %H = short hostname
  *   %j = per-session
  *   %p = pid
  *   %u = uid
@@ -222,7 +223,7 @@ static int jobid_interpret_string(const char *jobfmt, char *jobid,
 	char c;
 
 	while ((c = *jobfmt++) && joblen > 1) {
-		char f;
+		char f, *p;
 		int l;
 
 		if (isspace(c)) /* Don't allow embedded spaces */
@@ -232,6 +233,7 @@ static int jobid_interpret_string(const char *jobfmt, char *jobid,
 			*jobid = c;
 			joblen--;
 			jobid++;
+			*jobid = '\0';
 			continue;
 		}
 
@@ -247,6 +249,15 @@ static int jobid_interpret_string(const char *jobfmt, char *jobid,
 			l = snprintf(jobid, joblen, "%s",
 				     init_utsname()->nodename);
 			break;
+		case 'H': /* short hostname. Cut at first dot */
+			l = snprintf(jobid, joblen, "%s",
+				     init_utsname()->nodename);
+			p = strnchr(jobid, joblen, '.');
+			if (p) {
+				*p = '\0';
+				l = p - jobid;
+			}
+			break;
 		case 'j': /* jobid requested by process */
 			l = snprintf(jobid, joblen, "%s",
 				     jobid_current() ?: "jobid");
-- 
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-02-09  0:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  0:54 [lustre-devel] [PATCH 0/9] Sync to OpenSFS as of Feb 8, 2021 James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 1/9] lustre: llite: send file mode with rename RPC James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 2/9] lustre: flr: skip unknown FLR component types James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 3/9] lustre: obdclass: connect vs disconnect race James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 4/9] lustre: osc: correctly update size/kms for fallocate James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 5/9] lustre: ldlm: don't change GROUP lock GID on client James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 6/9] lustre: sec: get rid of bad rss-counter state messages James Simmons
2021-02-09  0:54 ` James Simmons [this message]
2021-02-09  0:54 ` [lustre-devel] [PATCH 8/9] lustre: osc: avoid crash if ocd reset James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 9/9] lustre: lov: return stripe_count=1 instead of 0 for DoM files 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=1612832067-1449-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 \
    --cc=ys@whamcloud.com \
    /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).