Re: [PATCH v2] md/r5cache: generate R5LOG_PAYLOAD_FLUSH

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

 



On Thu, Mar 09, 2017 at 04:24:03PM -0800, Song Liu wrote:
> In r5c_finish_stripe_write_out(), R5LOG_PAYLOAD_FLUSH is append to
> log->current_io.
> 
> Appending R5LOG_PAYLOAD_FLUSH in quiesce needs extra writes to
> journal. To simplify the logic, we just skip R5LOG_PAYLOAD_FLUSH in
> quiesce.
> 
> Even R5LOG_PAYLOAD_FLUSH supports multiple stripes per payload.
> However, current implementation is one stripe per R5LOG_PAYLOAD_FLUSH,
> which is simpler.
> 
> Signed-off-by: Song Liu <songliubraving@xxxxxx>
> ---
>  drivers/md/raid5-cache.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 44 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
> index e69f922..f148c68 100644
> --- a/drivers/md/raid5-cache.c
> +++ b/drivers/md/raid5-cache.c
> @@ -588,10 +588,11 @@ static void r5l_log_endio(struct bio *bio)
>  
>  	bio_put(bio);
>  	mempool_free(io->meta_page, log->meta_pool);
> +	__r5l_set_io_unit_state(io, IO_UNIT_IO_END);
>  
>  	spin_lock_irqsave(&log->io_list_lock, flags);
> -	__r5l_set_io_unit_state(io, IO_UNIT_IO_END);
why move this out the lock?

> -	if (log->need_cache_flush)
> +
> +	if (log->need_cache_flush && !list_empty(&io->stripe_list))
>  		r5l_move_to_end_ios(log);
>  	else
>  		r5l_log_run_stripes(log);
> @@ -619,9 +620,11 @@ static void r5l_log_endio(struct bio *bio)
>  			bio_endio(bi);
>  			atomic_dec(&io->pending_stripe);
>  		}
> -		if (atomic_read(&io->pending_stripe) == 0)
> -			__r5l_stripe_write_finished(io);
>  	}
> +
> +	/* finish flush only io_unit and PAYLOAD_FLUSH only io_unit */
> +	if (list_empty(&io->stripe_list))

we don't hold lock here, so can't check the list. checking the pending_stripe
should work too and is safe.

Thanks,
Shaohua
--
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