Message ID | 20230407235822.1672286-9-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Submit zoned writes in order | expand |
On 4/8/23 08:58, Bart Van Assche wrote: > Make deadline_skip_seq_writes() shorter without changing its > functionality. > > Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com> > Cc: Christoph Hellwig <hch@lst.de> > Cc: Ming Lei <ming.lei@redhat.com> > Cc: Mike Snitzer <snitzer@kernel.org> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > block/mq-deadline.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/block/mq-deadline.c b/block/mq-deadline.c > index d885ccf49170..50a9d3b0a291 100644 > --- a/block/mq-deadline.c > +++ b/block/mq-deadline.c > @@ -312,12 +312,9 @@ static struct request *deadline_skip_seq_writes(struct deadline_data *dd, > struct request *rq) > { > sector_t pos = blk_rq_pos(rq); > - sector_t skipped_sectors = 0; > > - while (rq) { > - if (blk_rq_pos(rq) != pos + skipped_sectors) > - break; > - skipped_sectors += blk_rq_sectors(rq); > + while (rq && blk_rq_pos(rq) == pos) { > + pos += blk_rq_sectors(rq); > rq = deadline_latter_request(rq); > } Not really related to this series at all. But looks good. Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
diff --git a/block/mq-deadline.c b/block/mq-deadline.c index d885ccf49170..50a9d3b0a291 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -312,12 +312,9 @@ static struct request *deadline_skip_seq_writes(struct deadline_data *dd, struct request *rq) { sector_t pos = blk_rq_pos(rq); - sector_t skipped_sectors = 0; - while (rq) { - if (blk_rq_pos(rq) != pos + skipped_sectors) - break; - skipped_sectors += blk_rq_sectors(rq); + while (rq && blk_rq_pos(rq) == pos) { + pos += blk_rq_sectors(rq); rq = deadline_latter_request(rq); }
Make deadline_skip_seq_writes() shorter without changing its functionality. Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Cc: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/mq-deadline.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)