qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v5 0/2] block: enforce minimal 4096 alignment in


From: Paolo Bonzini
Subject: Re: [Qemu-block] [PATCH v5 0/2] block: enforce minimal 4096 alignment in qemu_blockalign
Date: Fri, 29 May 2015 18:43:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0


On 13/05/2015 18:46, Denis V. Lunev wrote:
> I agree with this. Kernel guys are aware and may be we will have
> the fix after a while... I have heard (not tested) that performance
> loss over multi-queue SSD is around 30%.

I came up with this patch... can you test it with your test case
(and old QEMU) to see if it works for you?  I don't see much
improvement, but neither do I see it with new QEMU.

Paolo

diff --git a/block/bio.c b/block/bio.c
index f66a4eae16ee..df5bde7ebded 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -705,6 +705,7 @@ static int __bio_add_page(struct request_queue *q, struct 
bio *bio, struct page
 {
        int retried_segments = 0;
        struct bio_vec *bvec;
+       int speculative_len;
 
        /*
         * cloned bio must not modify vec list
@@ -712,7 +713,16 @@ static int __bio_add_page(struct request_queue *q, struct 
bio *bio, struct page
        if (unlikely(bio_flagged(bio, BIO_CLONED)))
                return 0;
 
-       if (((bio->bi_iter.bi_size + len) >> 9) > max_sectors)
+       /*
+        * If the bio is not page-aligned, stop if we cannot fit this entire
+        * page in the vector.  This is a very large write, so we'd like
+        * to split it so as to keep the remaining bios aligned.
+        */
+       speculative_len = len;
+       if (bio->bi_iter.bi_size & (PAGE_SIZE - 1) && offset == 0)
+               speculative_len = PAGE_SIZE;
+
+       if (((bio->bi_iter.bi_size + speculative_len) >> 9) > max_sectors)
                return 0;
 
        /*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]