The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-327.10.1.vz7.12.2 ------> commit a20b3f8cdaf0af444ecb96993b241fe7232e11d4 Author: Maxim Patlasov <mpatla...@virtuozzo.com> Date: Wed Mar 16 17:20:49 2016 +0400
ploop: replace BLOCK_UNINIT Patchset description: ploop: improve the performance of submit_alloc path Instead of using pagecache_write_begin/pagecache_write_end method, it is beneficial to preallocate space, then write data directly to block-device, then convert uninitialized extents (ext4) explicitly. The following series implements: - a preparation patch replcacing BLOCK_UNINIT with em->uninit - a patch implementing performance improvement === This patch description: Next patch will need em->block_start even for unwritten extents. Instead of using em->block_start == ~0, let's introduce new explicit field of 'em'. https://jira.sw.ru/browse/PSBM-22381 Signed-off-by: Maxim Patlasov <mpatla...@virtuozzo.com> Acked-by: Dmitry Monakhov <dmonak...@virtuozzo.com> --- drivers/block/ploop/io_direct.c | 10 +++++----- drivers/block/ploop/io_direct_map.c | 6 +++--- drivers/block/ploop/io_direct_map.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c index 3678d5b..514af4b 100644 --- a/drivers/block/ploop/io_direct.c +++ b/drivers/block/ploop/io_direct.c @@ -135,7 +135,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq, if (IS_ERR(em)) goto out_em_err; - if (write && em->block_start == BLOCK_UNINIT) { + if (write && em->uninit) { sector_t end = (sector_t)(iblk + 1) << preq->plo->cluster_log; sec = (sector_t)iblk << preq->plo->cluster_log; @@ -147,7 +147,7 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq, em = extent_lookup_create(io, sec, end - sec); if (IS_ERR(em)) goto out_em_err; - if (em->block_start != BLOCK_UNINIT) + if (!em->uninit) goto write_unint_fail; sec = em->end; @@ -191,13 +191,13 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq, em = extent_lookup_create(io, sec, size); if (IS_ERR(em)) goto out_em_err; - if (write && em->block_start == BLOCK_UNINIT) + if (write && em->uninit) goto write_unint_fail; } nsec = dio_isec_to_phys(em, sec); - if (em->block_start != BLOCK_UNINIT && + if (!em->uninit && (bio == NULL || bio->bi_sector + (bio->bi_size>>9) != nsec)) { @@ -214,7 +214,7 @@ flush_bio: if (copy > ((em->end - sec) << 9)) copy = (em->end - sec) << 9; - if (em->block_start == BLOCK_UNINIT) { + if (em->uninit) { void *kaddr = kmap_atomic(bv->bv_page); memset(kaddr + bv->bv_offset + bw.bv_off, 0, copy); kunmap_atomic(kaddr); diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c index 1146133..3f9a1ae 100644 --- a/drivers/block/ploop/io_direct_map.c +++ b/drivers/block/ploop/io_direct_map.c @@ -257,6 +257,7 @@ struct extent_map *ploop_alloc_extent_map(gfp_t mask) atomic_set(&em->refs, 1); INIT_LIST_HEAD(&em->lru_link); atomic_inc(&ploop_extent_maps_count); + em->uninit = false; } return em; } @@ -720,12 +721,11 @@ again: em->start = fi_extent.fe_logical >> 9; em->end = (fi_extent.fe_logical + fi_extent.fe_length) >> 9; + em->block_start = fi_extent.fe_physical >> 9; if (fi_extent.fe_flags & FIEMAP_EXTENT_UNWRITTEN) { - em->block_start = BLOCK_UNINIT; + em->uninit = true; } else { - em->block_start = fi_extent.fe_physical >> 9; - ret = add_extent_mapping(tree, em); if (ret == -EEXIST) { ploop_extent_put(em); diff --git a/drivers/block/ploop/io_direct_map.h b/drivers/block/ploop/io_direct_map.h index 4be1c5c..a83d1b3 100644 --- a/drivers/block/ploop/io_direct_map.h +++ b/drivers/block/ploop/io_direct_map.h @@ -3,8 +3,6 @@ #include <linux/rbtree.h> -#define BLOCK_UNINIT ~((sector_t) 0) - struct extent_map_tree { struct rb_root map; @@ -28,6 +26,8 @@ struct extent_map sector_t block_start; atomic_t refs; + + bool uninit; }; extern int max_extent_map_pages; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel