drivers/md/raid5-log.h

Source file repositories/reference/linux-study-clean/drivers/md/raid5-log.h

File Facts

System
Linux kernel
Corpus path
drivers/md/raid5-log.h
Extension
.h
Size
4553 bytes
Lines
152
Domain
Driver Families
Bucket
drivers/md
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) {
			/* writing out phase */
			if (s->waiting_extra_page)
				return 0;
			return r5l_write_stripe(conf->log, sh);
		} else if (test_bit(STRIPE_LOG_TRAPPED, &sh->state)) {
			/* caching phase */
			return r5c_cache_data(conf->log, sh);
		}
	} else if (raid5_has_ppl(conf)) {
		return ppl_write_stripe(conf, sh);
	}

	return -EAGAIN;
}

static inline void log_stripe_write_finished(struct stripe_head *sh)
{
	struct r5conf *conf = sh->raid_conf;

	if (conf->log)
		r5l_stripe_write_finished(sh);
	else if (raid5_has_ppl(conf))
		ppl_stripe_write_finished(sh);
}

static inline void log_write_stripe_run(struct r5conf *conf)
{
	if (conf->log)
		r5l_write_stripe_run(conf->log);
	else if (raid5_has_ppl(conf))
		ppl_write_stripe_run(conf);
}

static inline void log_flush_stripe_to_raid(struct r5conf *conf)
{
	if (conf->log)
		r5l_flush_stripe_to_raid(conf->log);
	else if (raid5_has_ppl(conf))
		ppl_write_stripe_run(conf);
}

static inline int log_handle_flush_request(struct r5conf *conf, struct bio *bio)
{
	int ret = -ENODEV;

	if (conf->log)
		ret = r5l_handle_flush_request(conf->log, bio);
	else if (raid5_has_ppl(conf))
		ret = ppl_handle_flush_request(bio);

	return ret;
}

static inline void log_quiesce(struct r5conf *conf, int quiesce)
{
	if (conf->log)
		r5l_quiesce(conf->log, quiesce);
	else if (raid5_has_ppl(conf))
		ppl_quiesce(conf, quiesce);
}

static inline void log_exit(struct r5conf *conf)
{
	if (conf->log)
		r5l_exit_log(conf);
	else if (raid5_has_ppl(conf))
		ppl_exit_log(conf);
}

static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev,
			   bool ppl)
{
	if (journal_dev)
		return r5l_init_log(conf, journal_dev);
	else if (ppl)
		return ppl_init_log(conf);

	return 0;
}

static inline int log_modify(struct r5conf *conf, struct md_rdev *rdev, bool add)
{
	if (raid5_has_ppl(conf))
		return ppl_modify_log(conf, rdev, add);

	return 0;
}

#endif

Annotation

Implementation Notes