mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Madper Xie <cxie@redhat.com>
To: tony.luck@intel.com, keescook@chromium.org, ccross@android.com,
	anton@enomsg.org, seiji.aguchi@hds.com
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	bbboson@gmail.com, Madper Xie <cxie@redhat.com>
Subject: [PATCH 2/2] pstore: Differentiating names by adding count and timestamp
Date: Wed, 30 Oct 2013 17:44:54 +0800	[thread overview]
Message-ID: <1383126294-28793-3-git-send-email-cxie@redhat.com> (raw)
In-Reply-To: <1383126294-28793-1-git-send-email-cxie@redhat.com>

From: Madper Xie <bbboson@gmail.com>

pstore denominates dumped file as type-psname-id. it makes many file have
the same name if there are many entries in backend have the same id.
So adding count and timestamp to file name for differentiating.

Signed-off-by: Madper Xie <cxie@redhat.com>
---
 fs/pstore/inode.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 0ae994c..36b502f 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -285,7 +285,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
 	int			rc = 0;
 	char			name[PSTORE_NAMELEN];
 	struct pstore_private	*private, *pos;
-	unsigned long		flags;
+	unsigned long		flags, timestamp;
 
 	spin_lock_irqsave(&allpstore_lock, flags);
 	list_for_each_entry(pos, &allpstore, list) {
@@ -316,35 +316,42 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
 	private->count = count;
 	private->psi = psi;
 	memcpy(&private->time, &time, sizeof(struct timespec));
+	timestamp = time.tv_sec;
 
 	switch (type) {
 	case PSTORE_TYPE_DMESG:
-		sprintf(name, "dmesg-%s-%lld%s", psname, id,
-						compressed ? ".enc.z" : "");
+		sprintf(name, "dmesg-%s-%lld-%d-%ld%s", psname, id, count,
+			timestamp, compressed ? ".enc.z" : "");
 		break;
 	case PSTORE_TYPE_CONSOLE:
-		sprintf(name, "console-%s", psname);
+		sprintf(name, "console-%s-%d-%ld", psname, count, timestamp);
 		break;
 	case PSTORE_TYPE_FTRACE:
-		sprintf(name, "ftrace-%s", psname);
+		sprintf(name, "ftrace-%s-%d-%ld", psname, count, timestamp);
 		break;
 	case PSTORE_TYPE_MCE:
-		sprintf(name, "mce-%s-%lld", psname, id);
+		sprintf(name, "mce-%s-%lld-%d-%ld", psname, id, count,
+			timestamp);
 		break;
 	case PSTORE_TYPE_PPC_RTAS:
-		sprintf(name, "rtas-%s-%lld", psname, id);
+		sprintf(name, "rtas-%s-%lld-%d-%ld", psname, id, count,
+			timestamp);
 		break;
 	case PSTORE_TYPE_PPC_OF:
-		sprintf(name, "powerpc-ofw-%s-%lld", psname, id);
+		sprintf(name, "powerpc-ofw-%s-%lld-%d-%ld", psname, id, count,
+			timestamp);
 		break;
 	case PSTORE_TYPE_PPC_COMMON:
-		sprintf(name, "powerpc-common-%s-%lld", psname, id);
+		sprintf(name, "powerpc-common-%s-%lld-%d-%ld", psname, id,
+			count, timestamp);
 		break;
 	case PSTORE_TYPE_UNKNOWN:
-		sprintf(name, "unknown-%s-%lld", psname, id);
+		sprintf(name, "unknown-%s-%lld-%d-%ld", psname, id, count,
+			timestamp);
 		break;
 	default:
-		sprintf(name, "type%d-%s-%lld", type, psname, id);
+		sprintf(name, "type%d-%s-%lld-%d-%ld", type, psname, id, count,
+			timestamp);
 		break;
 	}
 
-- 
1.8.4.2


  parent reply	other threads:[~2013-10-30  9:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30  9:44 [PATCH 0/2] make all stored entries accessible Madper Xie
2013-10-30  9:44 ` [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate Madper Xie
2013-10-30 14:35   ` Seiji Aguchi
2013-10-30 14:51     ` Madper Xie
2013-10-30  9:44 ` Madper Xie [this message]
2013-10-30 14:38   ` [PATCH 2/2] pstore: Differentiating names by adding count and timestamp Seiji Aguchi
2013-10-30 21:11 ` [PATCH 0/2] make all stored entries accessible Luck, Tony
2013-10-30 23:27   ` Seiji Aguchi
2013-10-31  0:24     ` Luck, Tony
2013-10-31  3:00       ` Madper Xie
2013-10-31 14:35         ` Seiji Aguchi
2013-10-31 20:22           ` Luck, Tony
2013-10-31 23:22             ` Seiji Aguchi

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=1383126294-28793-3-git-send-email-cxie@redhat.com \
    --to=cxie@redhat.com \
    --cc=anton@enomsg.org \
    --cc=bbboson@gmail.com \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seiji.aguchi@hds.com \
    --cc=tony.luck@intel.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

all inboxes | Powered by JetHome®