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

From: Andrew Morton
Date: Sun Nov 22 2009 - 14:51:37 EST


On Sun, 22 Nov 2009 22:18:36 +0300 Ilya Loginov <isloginov@xxxxxxxxx> wrote:

> On Sun, 22 Nov 2009 10:48:16 -0800
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> > 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().
>
> I tried this way from the beginning, and to avoid redefinitions I enclose
> everything in #if #endif in *.c files. I think it is not very good.
> So there are two possibilities.
>
> 1. To keep it like it is now and in this way there will be quite a lot of code.
> But in previous letters I gave statistics on the flush_dcache_page call in a
> kernel. And our case is particular. There will not be generated a lot of code.
> Or just take away inline.
>
> 2. Or it is better to carry over normal realization to *.c file and enclose
> everything by one more #if #endif.
>
> What do you consier to be better?

3. :)

In .h:

#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
extern void rq_flush_dcache_pages(struct request *rq);
#else
static inline void bio_flush_dcache_pages(struct bio *bi)
{
}
#endif

In .c:

#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
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);
}
EXPORT_SYMBOL(rq_flush_dcache_pages);
#endif
--
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/