lkml.org 
[lkml]   [2013]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] block: Introduce bio_for_each_page()
>  void zero_fill_bio(struct bio *bio)
> {
> - unsigned long flags;
> struct bio_vec bv;
> struct bvec_iter iter;
>
> - bio_for_each_segment(bv, bio, iter) {
> +#if defined(CONFIG_HIGHMEM) || defined(ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE)
> + bio_for_each_page(bv, bio, iter) {
> + unsigned long flags;
> char *data = bvec_kmap_irq(&bv, &flags);
> memset(data, 0, bv.bv_len);
> flush_dcache_page(bv.bv_page);
> bvec_kunmap_irq(data, &flags);
> }
> +#else
> + bio_for_each_segment(bv, bio, iter)
> + memset(page_address(bv.bv_page) + bv.bv_offset,
> + 0, bv.bv_len);
> +#endif

This looks pretty sketchy. I'd expect this to be doable with one loop
and that bvec_kmap_irq() and flush_dcache_page() would fall back to
page_address() and nops when they're not needed.

Where did this come from?

- z


\
 
 \ /
  Last update: 2013-09-25 23:41    [W:0.071 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site