git » libjio » commit e416a50

[API BREAK] Remove jfsck_return.apply_error

author Alberto Bertogli
2009-07-12 23:05:30 UTC
committer Alberto Bertogli
2009-07-12 23:10:11 UTC
parent 840d25e3529a34b4f575c4a3af387b4db51d81c5

[API BREAK] Remove jfsck_return.apply_error

If jfsck() returns successfully, it should be possible to assume the file
is in a consistent state. However, currently if jfsck() fails to apply a
transaction it will report that in the jfsck_return structure, which is
misleading.

This patch changes that behaviour, making jfsck() return error in that
case, rendering the apply_error member useless.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

bindings/python/libjio.c +0 -1
libjio/check.c +2 -3
libjio/jiofsck.c +0 -1
libjio/libjio.3 +0 -1
libjio/libjio.h +0 -3
tests/behaviour/tf.py +0 -1

diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c
index 45a9c0b..10c5eba 100644
--- a/bindings/python/libjio.c
+++ b/bindings/python/libjio.c
@@ -682,7 +682,6 @@ static PyObject *jf_jfsck(PyObject *self, PyObject *args, PyObject *kw)
 	PyDict_SetItemString(dict, "in_progress", PyLong_FromLong(res.in_progress));
 	PyDict_SetItemString(dict, "broken", PyLong_FromLong(res.broken));
 	PyDict_SetItemString(dict, "corrupt", PyLong_FromLong(res.corrupt));
-	PyDict_SetItemString(dict, "apply_error", PyLong_FromLong(res.apply_error));
 	PyDict_SetItemString(dict, "reapplied", PyLong_FromLong(res.reapplied));
 
 	return dict;
diff --git a/libjio/check.c b/libjio/check.c
index 6a47a4f..2927147 100644
--- a/libjio/check.c
+++ b/libjio/check.c
@@ -110,7 +110,6 @@ enum jfsck_return jfsck(const char *name, const char *jdir,
 	res->in_progress = 0;
 	res->broken = 0;
 	res->corrupt = 0;
-	res->apply_error = 0;
 	res->reapplied = 0;
 
 	fs.fd = open(name, O_RDWR | O_SYNC);
@@ -279,8 +278,8 @@ enum jfsck_return jfsck(const char *name, const char *jdir,
 		rv = jtrans_commit(curts);
 
 		if (rv < 0) {
-			res->apply_error++;
-			goto loop;
+			ret = J_EIO;
+			goto exit;
 		}
 		res->reapplied++;
 
diff --git a/libjio/jiofsck.c b/libjio/jiofsck.c
index 8cfe00f..1508e9c 100644
--- a/libjio/jiofsck.c
+++ b/libjio/jiofsck.c
@@ -85,7 +85,6 @@ int main(int argc, char **argv)
 	printf("In progress:\t %d\n", res.in_progress);
 	printf("Broken:\t\t %d\n", res.broken);
 	printf("Corrupt:\t %d\n", res.corrupt);
-	printf("Apply error:\t %d\n", res.apply_error);
 	printf("Reapplied:\t %d\n", res.reapplied);
 	printf("\n");
 
diff --git a/libjio/libjio.3 b/libjio/libjio.3
index 9c89b7f..5fa6cd6 100644
--- a/libjio/libjio.3
+++ b/libjio/libjio.3
@@ -42,7 +42,6 @@ libjio - A library for Journaled I/O
     int invalid;          /* invalid files in the journal directory */
     int in_progress;      /* transactions in progress */
     int broken;           /* transactions broken */
-    int apply_error;      /* errors applying the transaction */
     int rollbacked;       /* transactions that were rollbacked */
     ...
 };
diff --git a/libjio/libjio.h b/libjio/libjio.h
index 562c8db..a7c5250 100644
--- a/libjio/libjio.h
+++ b/libjio/libjio.h
@@ -59,9 +59,6 @@ struct jfsck_result {
 	/** Number of corrupt transactions */
 	int corrupt;
 
-	/** Number of errors applying transactions */
-	int apply_error;
-
 	/** Number of transactions successfully reapplied */
 	int reapplied;
 };
diff --git a/tests/behaviour/tf.py b/tests/behaviour/tf.py
index 3591f94..607e4e8 100644
--- a/tests/behaviour/tf.py
+++ b/tests/behaviour/tf.py
@@ -126,7 +126,6 @@ def fsck_verify(n, **kwargs):
 		'reapplied': 0,
 		'corrupt': 0,
 		'in_progress': 0,
-		'apply_error': 0,
 	}
 	expected.update(kwargs)
 	expected['total'] = sum(expected.values())