[PATCH-RESEND 15/23] staging/lustre/changelog: fix CL_LAYOUT, accept all types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andreas Dilger <andreas.dilger@xxxxxxxxx>

In order to avoid compatibility issues with older ChangeLog consumers,
change the new CL_LAYOUT record to use the value previously assigned
to CL_IOCTL.  The CL_IOCTL type was never used anywhere, and it didn't
really make any sense as a ChangeLog record, since it could really
mean anything at all.

The changelog_show_cb() function is renamed to changelog_kkuc_cb(),
since it is really about consuming the ChangeLog and passing it up to
the kernel-user-coms interface.  At some point we should consider to
implement a DBUS-based ChangeLog interface as well.

The changelog_kkuc_cb() "sanity check" on cr_type was removed, since
there is no reason the client kernel needs to know every record type
that is being passed to userspace.  It is up to the client tool to
determine what records that it can process.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3279
Lustre-change: http://review.whamcloud.com/6308
Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
Reviewed-by: Bobi Jam <bobijam@xxxxxxxxx>
Reviewed-by: Jinshan Xiong <jinshan.xiong@xxxxxxxxx>
Reviewed-by: Mike Pershin <mike.pershin@xxxxxxxxx>
Reviewed-by: Aurelien Degremont <aurelien.degremont@xxxxxx>
Reviewed-by: Oleg Drokin <oleg.drokin@xxxxxxxxx>
Signed-off-by: Peng Tao <tao.peng@xxxxxxx>
Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    7 +++----
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   15 ++++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index eaa94f5..7613406 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -636,7 +636,7 @@ enum changelog_rec_type {
 	CL_EXT      = 9,  /* namespace extended record (2nd half of rename) */
 	CL_OPEN     = 10, /* not currently used */
 	CL_CLOSE    = 11, /* may be written to log only with mtime change */
-	CL_IOCTL    = 12,
+	CL_LAYOUT   = 12, /* file layout/striping modified, no data changed */
 	CL_TRUNC    = 13,
 	CL_SETATTR  = 14,
 	CL_XATTR    = 15,
@@ -644,15 +644,14 @@ enum changelog_rec_type {
 	CL_MTIME    = 17, /* Precedence: setattr > mtime > ctime > atime */
 	CL_CTIME    = 18,
 	CL_ATIME    = 19,
-	CL_LAYOUT   = 20,
 	CL_LAST
 };
 
 static inline const char *changelog_type2str(int type) {
 	static const char *changelog_str[] = {
 		"MARK",  "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK",
-		"RMDIR", "RENME", "RNMTO", "OPEN",  "CLOSE", "IOCTL", "TRUNC",
-		"SATTR", "XATTR", "HSM",   "MTIME", "CTIME", "ATIME", "LAYOUT"
+		"RMDIR", "RENME", "RNMTO", "OPEN",  "CLOSE", "LAYOUT", "TRUNC",
+		"SATTR", "XATTR", "HSM",   "MTIME", "CTIME", "ATIME",
 	};
 
 	if (type >= 0 && type < CL_LAST)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 88454bf..3cf9d8d 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1469,7 +1469,7 @@ struct changelog_show {
 	struct obd_device *cs_obd;
 };
 
-static int changelog_show_cb(const struct lu_env *env, struct llog_handle *llh,
+static int changelog_kkuc_cb(const struct lu_env *env, struct llog_handle *llh,
 			     struct llog_rec_hdr *hdr, void *data)
 {
 	struct changelog_show *cs = data;
@@ -1478,11 +1478,12 @@ static int changelog_show_cb(const struct lu_env *env, struct llog_handle *llh,
 	int len, rc;
 	ENTRY;
 
-	if ((rec->cr_hdr.lrh_type != CHANGELOG_REC) ||
-	    (rec->cr.cr_type >= CL_LAST)) {
-		CERROR("Not a changelog rec %d/%d\n", rec->cr_hdr.lrh_type,
-		       rec->cr.cr_type);
-		RETURN(-EINVAL);
+	if (rec->cr_hdr.lrh_type != CHANGELOG_REC) {
+		rc = -EINVAL;
+		CERROR("%s: not a changelog rec %x/%d: rc = %d\n",
+		       cs->cs_obd->obd_name, rec->cr_hdr.lrh_type,
+		       rec->cr.cr_type, rc);
+		RETURN(rc);
 	}
 
 	if (rec->cr.cr_index < cs->cs_startrec) {
@@ -1543,7 +1544,7 @@ static int mdc_changelog_send_thread(void *csdata)
 		GOTO(out, rc);
 	}
 
-	rc = llog_cat_process(NULL, llh, changelog_show_cb, cs, 0, 0);
+	rc = llog_cat_process(NULL, llh, changelog_kkuc_cb, cs, 0, 0);
 
 	/* Send EOF no matter what our result */
 	if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch),
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux