Commit a4a82ce3 authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer
Browse files

dm: correct block comments format.

parent 255e2646
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -259,9 +259,11 @@ static void buffer_record_stack(struct dm_buffer *b)
}
#endif

/*----------------------------------------------------------------
/*
 *----------------------------------------------------------------
 * A red/black tree acts as an index for all the buffers.
 *--------------------------------------------------------------*/
 *----------------------------------------------------------------
 */
static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block)
{
	struct rb_node *n = c->buffer_tree.rb_node;
@@ -562,7 +564,8 @@ static void __relink_lru(struct dm_buffer *b, int dirty)
	b->last_accessed = jiffies;
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------------------
 * Submit I/O on the buffer.
 *
 * Bio interface is faster but it has some problems:
@@ -578,7 +581,8 @@ static void __relink_lru(struct dm_buffer *b, int dirty)
 * rejects the bio because it is too large, use dm-io layer to do the I/O.
 * The dm-io layer splits the I/O into multiple requests, avoiding the above
 * shortcomings.
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------------------
 */

/*
 * dm-io completion routine. It just calls b->bio.bi_end_io, pretending
@@ -717,9 +721,11 @@ static void submit_io(struct dm_buffer *b, enum req_op op,
		use_dmio(b, op, sector, n_sectors, offset);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Writing dirty buffers
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

/*
 * The endio routine for write.
@@ -999,9 +1005,11 @@ static void __check_watermark(struct dm_bufio_client *c,
		__write_dirty_buffers_async(c, 1, write_list);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Getting a buffer
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

static struct dm_buffer *__bufio_new(struct dm_bufio_client *c, sector_t block,
				     enum new_flag nf, int *need_submit,
@@ -2060,9 +2068,11 @@ static void work_fn(struct work_struct *w)
			   DM_BUFIO_WORK_TIMER_SECS * HZ);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Module setup
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

/*
 * This is called only once for the whole dm_bufio module.
+4 −3
Original line number Diff line number Diff line
@@ -163,10 +163,11 @@ struct dm_cache_metadata {
	struct dm_bitset_cursor dirty_cursor;
};

/*-------------------------------------------------------------------
/*
 *-----------------------------------------------------------------
 * superblock validator
 *-----------------------------------------------------------------*/

 *-----------------------------------------------------------------
 */
#define SUPERBLOCK_CSUM_XOR 9031977

static void sb_prepare_for_write(struct dm_block_validator *v,
+37 −21
Original line number Diff line number Diff line
@@ -525,9 +525,11 @@ static unsigned int lock_level(struct bio *bio)
		READ_WRITE_LOCK_LEVEL;
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Per bio data
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

static struct per_bio_data *get_per_bio_data(struct bio *bio)
{
@@ -706,9 +708,11 @@ static bool is_discarded_oblock(struct cache *cache, dm_oblock_t b)
	return r;
}

/*----------------------------------------------------------------
/*
 * -------------------------------------------------------------
 * Remapping
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
static void remap_to_origin(struct cache *cache, struct bio *bio)
{
	bio_set_dev(bio, cache->origin_dev->bdev);
@@ -834,9 +838,11 @@ static void remap_to_origin_and_cache(struct cache *cache, struct bio *bio,
	remap_to_cache(cache, bio, cblock);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Failure modes
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
static enum cache_metadata_mode get_cache_mode(struct cache *cache)
{
	return cache->features.mode;
@@ -973,13 +979,14 @@ static void update_stats(struct cache_stats *stats, enum policy_operation op)
	}
}

/*----------------------------------------------------------------
/*
 *---------------------------------------------------------------------
 * Migration processing
 *
 * Migration covers moving data from the origin device to the cache, or
 * vice versa.
 *--------------------------------------------------------------*/

 *---------------------------------------------------------------------
 */
static void inc_io_migrations(struct cache *cache)
{
	atomic_inc(&cache->nr_io_migrations);
@@ -1431,9 +1438,11 @@ static int mg_start(struct cache *cache, struct policy_work *op, struct bio *bio
	return mg_lock_writes(mg);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * invalidation processing
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

static void invalidate_complete(struct dm_cache_migration *mg, bool success)
{
@@ -1554,9 +1563,11 @@ static int invalidate_start(struct cache *cache, dm_cblock_t cblock,
	return invalidate_lock(mg);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * bio processing
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

enum busy {
	IDLE,
@@ -1764,9 +1775,11 @@ static bool process_discard_bio(struct cache *cache, struct bio *bio)
{
	dm_dblock_t b, e;

	// FIXME: do we need to lock the region?  Or can we just assume the
	// user wont be so foolish as to issue discard concurrently with
	// other IO?
	/*
	 * FIXME: do we need to lock the region?  Or can we just assume the
	 * user wont be so foolish as to issue discard concurrently with
	 * other IO?
	 */
	calc_discard_block_range(cache, bio, &b, &e);
	while (b != e) {
		set_discard(cache, b);
@@ -1812,10 +1825,11 @@ static void process_deferred_bios(struct work_struct *ws)
		schedule_commit(&cache->committer);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Main worker loop
 *--------------------------------------------------------------*/

 *--------------------------------------------------------------
 */
static void requeue_deferred_bios(struct cache *cache)
{
	struct bio *bio;
@@ -1871,9 +1885,11 @@ static void check_migrations(struct work_struct *ws)
	}
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Target methods
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */

/*
 * This function gets called on the error paths of the constructor, so we
+4 −3
Original line number Diff line number Diff line
@@ -364,9 +364,10 @@ static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti,
		bs = crypto_skcipher_blocksize(any_tfm(cc));
	log = ilog2(bs);

	/* we need to calculate how far we must shift the sector count
	 * to get the cipher block count, we use this shift in _gen */

	/*
	 * We need to calculate how far we must shift the sector count
	 * to get the cipher block count, we use this shift in _gen.
	 */
	if (1 << log != bs) {
		ti->error = "cypher blocksize is not a power of 2";
		return -EINVAL;
+38 −20
Original line number Diff line number Diff line
@@ -22,9 +22,11 @@
#define INVALID_WRITESET_ROOT SUPERBLOCK_LOCATION
#define MIN_BLOCK_SIZE 8

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Writeset
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
struct writeset_metadata {
	uint32_t nr_bits;
	dm_block_t root;
@@ -148,9 +150,11 @@ static int writeset_test_and_set(struct dm_disk_bitset *info,
	return 1;
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * On disk metadata layout
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
#define SPACE_MAP_ROOT_SIZE 128
#define UUID_LEN 16

@@ -186,9 +190,11 @@ struct superblock_disk {
	__le64 metadata_snap;
} __packed;

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Superblock validation
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
static void sb_prepare_for_write(struct dm_block_validator *v,
				 struct dm_block *b,
				 size_t sb_block_size)
@@ -252,9 +258,11 @@ static struct dm_block_validator sb_validator = {
	.check = sb_check
};

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Low level metadata handling
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
#define DM_ERA_METADATA_BLOCK_SIZE 4096
#define ERA_MAX_CONCURRENT_LOCKS 5

@@ -658,13 +666,15 @@ static void swap_writeset(struct era_metadata *md, struct writeset *new_writeset
	synchronize_rcu();
}

/*----------------------------------------------------------------
/*
 *------------------------------------------------------------------------
 * Writesets get 'digested' into the main era array.
 *
 * We're using a coroutine here so the worker thread can do the digestion,
 * thus avoiding synchronisation of the metadata.  Digesting a whole
 * writeset in one go would cause too much latency.
 *--------------------------------------------------------------*/
 *------------------------------------------------------------------------
 */
struct digest {
	uint32_t era;
	unsigned int nr_bits, current_bit;
@@ -784,10 +794,12 @@ static int metadata_digest_start(struct era_metadata *md, struct digest *d)
	return 0;
}

/*----------------------------------------------------------------
 * High level metadata interface.  Target methods should use these, and not
 * the lower level ones.
 *--------------------------------------------------------------*/
/*
 *-----------------------------------------------------------------
 * High level metadata interface.  Target methods should use these,
 * and not the lower level ones.
 *-----------------------------------------------------------------
 */
static struct era_metadata *metadata_open(struct block_device *bdev,
					  sector_t block_size,
					  bool may_format)
@@ -1189,9 +1201,11 @@ struct rpc {
	struct completion complete;
};

/*----------------------------------------------------------------
/*
 *---------------------------------------------------------------
 * Remapping.
 *---------------------------------------------------------------*/
 *---------------------------------------------------------------
 */
static bool block_size_is_power_of_two(struct era *era)
{
	return era->sectors_per_block_shift >= 0;
@@ -1214,9 +1228,11 @@ static void remap_to_origin(struct era *era, struct bio *bio)
	bio_set_dev(bio, era->origin_dev->bdev);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Worker thread
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
static void wake_worker(struct era *era)
{
	if (!atomic_read(&era->suspended))
@@ -1403,9 +1419,11 @@ static void stop_worker(struct era *era)
	drain_workqueue(era->wq);
}

/*----------------------------------------------------------------
/*
 *--------------------------------------------------------------
 * Target methods
 *--------------------------------------------------------------*/
 *--------------------------------------------------------------
 */
static void era_destroy(struct era *era)
{
	if (era->md)
Loading