Merge branch 'for-4.18/dax' into libnvdimm-for-next
[sfrench/cifs-2.6.git] / drivers / nvdimm / pmem.c
index 06b41ec9f1b3747624d1f4d4eb4920efcc376d06..bf2dd2a4a5e60050f092ee3c2f14b01b76781b53 100644 (file)
@@ -164,11 +164,6 @@ static blk_status_t pmem_do_bvec(struct pmem_device *pmem, struct page *page,
        return rc;
 }
 
-/* account for REQ_FLUSH rename, replace with REQ_PREFLUSH after v4.8-rc1 */
-#ifndef REQ_FLUSH
-#define REQ_FLUSH REQ_PREFLUSH
-#endif
-
 static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
 {
        blk_status_t rc = 0;
@@ -179,7 +174,7 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
        struct pmem_device *pmem = q->queuedata;
        struct nd_region *nd_region = to_region(pmem);
 
-       if (bio->bi_opf & REQ_FLUSH)
+       if (bio->bi_opf & REQ_PREFLUSH)
                nvdimm_flush(nd_region);
 
        do_acct = nd_iostat_start(bio, &start);
@@ -320,7 +315,7 @@ static int pmem_attach_disk(struct device *dev,
 {
        struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
        struct nd_region *nd_region = to_nd_region(dev->parent);
-       int nid = dev_to_node(dev), fua, wbc;
+       int nid = dev_to_node(dev), fua;
        struct resource *res = &nsio->res;
        struct resource bb_res;
        struct nd_pfn *nd_pfn = NULL;
@@ -356,7 +351,6 @@ static int pmem_attach_disk(struct device *dev,
                dev_warn(dev, "unable to guarantee persistence of writes\n");
                fua = 0;
        }
-       wbc = nvdimm_has_cache(nd_region);
 
        if (!devm_request_mem_region(dev, res->start, resource_size(res),
                                dev_name(&ndns->dev))) {
@@ -407,7 +401,7 @@ static int pmem_attach_disk(struct device *dev,
                return PTR_ERR(addr);
        pmem->virt_addr = addr;
 
-       blk_queue_write_cache(q, wbc, fua);
+       blk_queue_write_cache(q, true, fua);
        blk_queue_make_request(q, pmem_make_request);
        blk_queue_physical_block_size(q, PAGE_SIZE);
        blk_queue_logical_block_size(q, pmem_sector_size(ndns));
@@ -438,7 +432,7 @@ static int pmem_attach_disk(struct device *dev,
                put_disk(disk);
                return -ENOMEM;
        }
-       dax_write_cache(dax_dev, wbc);
+       dax_write_cache(dax_dev, nvdimm_has_cache(nd_region));
        pmem->dax_dev = dax_dev;
 
        gendev = disk_to_dev(disk);