Merge tag 'powerpc-6.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[platform/kernel/linux-starfive.git] / drivers / md / dm-log.c
index 7c3f30c..afd94d2 100644 (file)
@@ -183,10 +183,12 @@ void dm_dirty_log_destroy(struct dm_dirty_log *log)
 }
 EXPORT_SYMBOL(dm_dirty_log_destroy);
 
-/*-----------------------------------------------------------------
+/*
+ *---------------------------------------------------------------
  * Persistent and core logs share a lot of their implementation.
  * FIXME: need a reload method to be called from a resume
- *---------------------------------------------------------------*/
+ *---------------------------------------------------------------
+ */
 /*
  * Magic for persistent mirrors: "MiRr"
  */
@@ -275,9 +277,11 @@ static inline void log_clear_bit(struct log_c *l,
        l->touched_dirtied = 1;
 }
 
-/*----------------------------------------------------------------
+/*
+ *---------------------------------------------------------------
  * Header IO
- *--------------------------------------------------------------*/
+ *--------------------------------------------------------------
+ */
 static void header_to_disk(struct log_header_core *core, struct log_header_disk *disk)
 {
        disk->magic = cpu_to_le32(core->magic);
@@ -353,11 +357,13 @@ static int _check_region_size(struct dm_target *ti, uint32_t region_size)
        return 1;
 }
 
-/*----------------------------------------------------------------
+/*
+ *--------------------------------------------------------------
  * core log constructor/destructor
  *
  * argv contains region_size followed optionally by [no]sync
- *--------------------------------------------------------------*/
+ *--------------------------------------------------------------
+ */
 #define BYTE_SHIFT 3
 static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
                              unsigned int argc, char **argv,
@@ -383,8 +389,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
                else if (!strcmp(argv[1], "nosync"))
                        sync = NOSYNC;
                else {
-                       DMWARN("unrecognised sync argument to "
-                              "dirty region log: %s", argv[1]);
+                       DMWARN("unrecognised sync argument to dirty region log: %s", argv[1]);
                        return -EINVAL;
                }
        }
@@ -442,8 +447,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
                 */
                buf_size =
                    dm_round_up((LOG_OFFSET << SECTOR_SHIFT) + bitset_size,
-                               bdev_logical_block_size(lc->header_location.
-                                                           bdev));
+                               bdev_logical_block_size(lc->header_location.bdev));
 
                if (buf_size > bdev_nr_bytes(dev->bdev)) {
                        DMWARN("log device %s too small: need %llu bytes",
@@ -532,11 +536,13 @@ static void core_dtr(struct dm_dirty_log *log)
        destroy_log_context(lc);
 }
 
-/*----------------------------------------------------------------
+/*
+ *---------------------------------------------------------------------
  * disk log constructor/destructor
  *
  * argv contains log_device region_size followed optionally by [no]sync
- *--------------------------------------------------------------*/
+ *---------------------------------------------------------------------
+ */
 static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti,
                    unsigned int argc, char **argv)
 {
@@ -647,12 +653,14 @@ static int disk_resume(struct dm_dirty_log *log)
 static uint32_t core_get_region_size(struct dm_dirty_log *log)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        return lc->region_size;
 }
 
 static int core_resume(struct dm_dirty_log *log)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        lc->sync_search = 0;
        return 0;
 }
@@ -660,12 +668,14 @@ static int core_resume(struct dm_dirty_log *log)
 static int core_is_clean(struct dm_dirty_log *log, region_t region)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        return log_test_bit(lc->clean_bits, region);
 }
 
 static int core_in_sync(struct dm_dirty_log *log, region_t region, int block)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        return log_test_bit(lc->sync_bits, region);
 }
 
@@ -718,12 +728,14 @@ static int disk_flush(struct dm_dirty_log *log)
 static void core_mark_region(struct dm_dirty_log *log, region_t region)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        log_clear_bit(lc, lc->clean_bits, region);
 }
 
 static void core_clear_region(struct dm_dirty_log *log, region_t region)
 {
        struct log_c *lc = (struct log_c *) log->context;
+
        if (likely(!lc->flush_failed))
                log_set_bit(lc, lc->clean_bits, region);
 }
@@ -758,8 +770,8 @@ static void core_set_region_sync(struct dm_dirty_log *log, region_t region,
        log_clear_bit(lc, lc->recovering_bits, region);
        if (in_sync) {
                log_set_bit(lc, lc->sync_bits, region);
-                lc->sync_count++;
-        } else if (log_test_bit(lc->sync_bits, region)) {
+               lc->sync_count++;
+       } else if (log_test_bit(lc->sync_bits, region)) {
                lc->sync_count--;
                log_clear_bit(lc, lc->sync_bits, region);
        }
@@ -767,16 +779,16 @@ static void core_set_region_sync(struct dm_dirty_log *log, region_t region,
 
 static region_t core_get_sync_count(struct dm_dirty_log *log)
 {
-        struct log_c *lc = (struct log_c *) log->context;
+       struct log_c *lc = (struct log_c *) log->context;
 
-        return lc->sync_count;
+       return lc->sync_count;
 }
 
 #define        DMEMIT_SYNC \
        do { \
                if (lc->sync != DEFAULTSYNC) \
                        DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : ""); \
-       } while (0);
+       } while (0)
 
 static int core_status(struct dm_dirty_log *log, status_type_t status,
                       char *result, unsigned int maxlen)
@@ -784,7 +796,7 @@ static int core_status(struct dm_dirty_log *log, status_type_t status,
        int sz = 0;
        struct log_c *lc = log->context;
 
-       switch(status) {
+       switch (status) {
        case STATUSTYPE_INFO:
                DMEMIT("1 %s", log->type->name);
                break;
@@ -809,7 +821,7 @@ static int disk_status(struct dm_dirty_log *log, status_type_t status,
        int sz = 0;
        struct log_c *lc = log->context;
 
-       switch(status) {
+       switch (status) {
        case STATUSTYPE_INFO:
                DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
                       lc->log_dev_flush_failed ? 'F' :