Re: [PATCH v6 03/11] md/r5cache: State machine for raid5-cache write back mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Nov 14, 2016, at 5:22 PM, Shaohua Li <shli@xxxxxxxxxx> wrote:
> 
>> The following detailed explanation is copied from the raid5-cache.c:
>> 
>> /*
>> * raid5 cache state machine
>> *
>> * With rhe RAID cache, each stripe works in two modes:
>> *      - caching mode
>> *      - writing-out mode
> 
> 'mode' is quite confusing here. it always remainders me r5c_journal_mode. can
> you use state?

I am not very sure whether state is the best name here. Maybe we can use "phase"?

>> + * Note: when the array is in write-through, each stripe still goes through
>> + * caching mode and writing-out mode. In such cases, this function is called
>> + * in r5c_handle_stripe_dirtying().
>> + */
>> +static void r5c_make_stripe_write_out(struct stripe_head *sh)
>> +{
>> +	struct r5conf *conf = sh->raid_conf;
>> +	struct r5l_log *log = conf->log;
>> +
>> +	if (!log)
>> +		return;
>> +	WARN_ON(test_bit(STRIPE_R5C_WRITE_OUT, &sh->state));
>> +	set_bit(STRIPE_R5C_WRITE_OUT, &sh->state);
>> +}
>> +
>> +/*
>> + * Setting proper flags after writing (or flushing) data and/or parity to the
>> + * log device. This is called from r5l_log_endio() or r5l_log_flush_endio().
>> + */
>> +static void r5c_finish_cache_stripe(struct stripe_head *sh)
>> +{
>> +	struct r5l_log *log = sh->raid_conf->log;
>> +
>> +	if (log->r5c_journal_mode == R5C_JOURNAL_MODE_WRITE_THROUGH) {
>> +		BUG_ON(!test_bit(STRIPE_R5C_WRITE_OUT, &sh->state));
>> +		/*
>> +		 * Set R5_InJournal for parity dev[pd_idx]. This means parity
>> +		 * is in the journal. For RAID 6, it is NOT necessary to set
>> +		 * the flag for dev[qd_idx], as the two parities are written
>> +		 * out together.
>> +		 */
>> +		set_bit(R5_InJournal, &sh->dev[sh->pd_idx].flags);
> 
> if this flag is only for pd_idx disk and you are using it to determine the
> stripe data is in journal, why not make it a stripe flag?
R5_InJournal is used in multiple place in the next patch. Using it here will 
save us a stripe flag. 

Thanks,
Song


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux