On Thu, Mar 8, 2018 at 6:51 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: >> --- /dev/null 1970-01-01 00:00:00.000000000 +0000 >> +++ linux-2.6/drivers/md/dm-writecache.c 2018-03-08 14:23:31.059999000 +0100 >> @@ -0,0 +1,2417 @@ >> +#include <linux/device-mapper.h> > > missing copyright statement, or for those new-fashioned SPDX statement. > >> +#define WRITEBACK_FUA true > > no business having this around. > >> +#ifndef bio_set_dev >> +#define bio_set_dev(bio, dev) ((bio)->bi_bdev = (dev)) >> +#endif >> +#ifndef timer_setup >> +#define timer_setup(t, c, f) setup_timer(t, c, (unsigned long)(t)) >> +#endif > > no business in mainline. > >> +/* >> + * On X86, non-temporal stores are more efficient than cache flushing. >> + * On ARM64, cache flushing is more efficient. >> + */ >> +#if defined(CONFIG_X86_64) >> +#define NT_STORE(dest, src) \ >> +do { \ >> + typeof(src) val = (src); \ >> + memcpy_flushcache(&(dest), &val, sizeof(src)); \ >> +} while (0) >> +#define COMMIT_FLUSHED() wmb() >> +#else >> +#define NT_STORE(dest, src) WRITE_ONCE(dest, src) >> +#define FLUSH_RANGE dax_flush >> +#define COMMIT_FLUSHED() do { } while (0) >> +#endif > > Please use proper APIs for this, this has no business in a driver. I had the same feedback, and Mikulas sent this useful enhancement to the memcpy_flushcache API: https://patchwork.kernel.org/patch/10217655/ ...it's in my queue to either push through -tip or add it to the next libnvdimm pull request for 4.17-rc1. -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel