aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_actlog.c
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2011-03-31 06:06:48 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:45:01 -0500
commit85f103d88c8eb91755eb3c103e5ead2c9389e35e (patch)
tree01d92aa9abfc4b755fda3a3849c843bdd096fb65 /drivers/block/drbd/drbd_actlog.c
parent6038178ebe29e6b5e4d519a5ac56653d156c90f9 (diff)
drbd: introduce the "initialized" activity log transaction type
So we can initialize a clean on disk activity log area, without the module complaining with loud assert messages because of checksum or magic value mismatches. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_actlog.c')
-rw-r--r--drivers/block/drbd/drbd_actlog.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 586776195a79..90ebbbb3dc27 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -31,6 +31,11 @@
31#include "drbd_int.h" 31#include "drbd_int.h"
32#include "drbd_wrappers.h" 32#include "drbd_wrappers.h"
33 33
34
35enum al_transaction_types {
36 AL_TR_UPDATE = 0,
37 AL_TR_INITIALIZED = 0xffff
38};
34/* all fields on disc in big endian */ 39/* all fields on disc in big endian */
35struct __packed al_transaction_on_disk { 40struct __packed al_transaction_on_disk {
36 /* don't we all like magic */ 41 /* don't we all like magic */
@@ -44,7 +49,8 @@ struct __packed al_transaction_on_disk {
44 __be32 crc32c; 49 __be32 crc32c;
45 50
46 /* type of transaction, special transaction types like: 51 /* type of transaction, special transaction types like:
47 * purge-all, set-all-idle, set-all-active, ... to-be-defined */ 52 * purge-all, set-all-idle, set-all-active, ... to-be-defined
53 * see also enum al_transaction_types */
48 __be16 transaction_type; 54 __be16 transaction_type;
49 55
50 /* we currently allow only a few thousand extents, 56 /* we currently allow only a few thousand extents,
@@ -476,6 +482,7 @@ int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
476 int active_extents = 0; 482 int active_extents = 0;
477 int transactions = 0; 483 int transactions = 0;
478 int found_valid = 0; 484 int found_valid = 0;
485 int found_initialized = 0;
479 int from = 0; 486 int from = 0;
480 int to = 0; 487 int to = 0;
481 u32 from_tnr = 0; 488 u32 from_tnr = 0;
@@ -504,6 +511,10 @@ int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
504 /* invalid data in that block */ 511 /* invalid data in that block */
505 if (rv == 0) 512 if (rv == 0)
506 continue; 513 continue;
514 if (be16_to_cpu(b->transaction_type) == AL_TR_INITIALIZED) {
515 ++found_initialized;
516 continue;
517 }
507 518
508 /* IO error */ 519 /* IO error */
509 if (rv == -1) { 520 if (rv == -1) {
@@ -535,7 +546,8 @@ int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
535 } 546 }
536 547
537 if (!found_valid) { 548 if (!found_valid) {
538 dev_warn(DEV, "No usable activity log found.\n"); 549 if (found_initialized != mx)
550 dev_warn(DEV, "No usable activity log found.\n");
539 mutex_unlock(&mdev->md_io_mutex); 551 mutex_unlock(&mdev->md_io_mutex);
540 return 1; 552 return 1;
541 } 553 }