Re: [PATCH] mtd: fix mtd_blkdevs problem with caches on somearchitectures (2.6.31)

From: Andrew Morton
Date: Sun Nov 22 2009 - 13:49:18 EST


On Sun, 22 Nov 2009 16:55:21 +0300 Ilya Loginov <isloginov@xxxxxxxxx> wrote:

> +#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
> +# error "You should to define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform."
> +#endif
> +#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
> +static inline void bio_flush_dcache_pages(struct bio *bi)
> +{
> + int i;
> + struct bio_vec* bvec;
> +
> + bio_for_each_segment(bvec, bi, i)
> + flush_dcache_page(bvec->bv_page);
> +}
> +#else
> +static inline void bio_flush_dcache_pages(struct bio *bi)
> +{
> +}
> +#endif
> +
> extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
> unsigned long, unsigned int, int, gfp_t);
> extern struct bio *bio_copy_user_iov(struct request_queue *,
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 69103e0..9b5214c 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -740,6 +740,24 @@ struct req_iterator {
> #define rq_iter_last(rq, _iter) \
> (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1)
>
> +#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
> +# error "You should to define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform."
> +#endif
> +#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
> +static inline void rq_flush_dcache_pages(struct request *rq)
> +{
> + struct req_iterator iter;
> + struct bio_vec* bvec;
> +
> + rq_for_each_segment(bvec, rq, iter)
> + flush_dcache_page(bvec->bv_page);
> +}
> +#else
> +static inline void rq_flush_dcache_pages(struct request *rq)
> +{
> +}
> +#endif

I don't think the non-stub versions of these should be inlined. They
will generate quite a lot of code and they're pretty heavyweight.
Better to implement them in block/ somewhere, and EXPORT_SYMBOL().

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/