[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54F844B3.9050303@plexistor.com>
Date: Thu, 05 Mar 2015 13:57:39 +0200
From: Boaz Harrosh <boaz@...xistor.com>
To: Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
"Roger C. Pao" <rcpao.enmotus@...il.com>,
Dan Williams <dan.j.williams@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
"H. Peter Anvin" <hpa@...or.com>,
Matthew Wilcox <willy@...ux.intel.com>,
Andy Lutomirski <luto@...capital.net>,
Christoph Hellwig <hch@...radead.org>
CC: Ross Zwisler <ross.zwisler@...ux.intel.com>
Subject: [PATCH 4/8] pmem: Add support for direct_access()
From: Ross Zwisler <ross.zwisler@...ux.intel.com>
Also fixed a top the initial version
[boaz]
SQUASHME pmem: Micro optimization the hotpath 002
Signed-off-by: Ross Zwisler <ross.zwisler@...ux.intel.com>
Signed-off-by: Boaz Harrosh <boaz@...xistor.com>
---
drivers/block/pmem.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c
index 750ffdf..f0f0ba0 100644
--- a/drivers/block/pmem.c
+++ b/drivers/block/pmem.c
@@ -111,9 +111,25 @@ static int pmem_rw_page(struct block_device *bdev, sector_t sector,
return 0;
}
+static long pmem_direct_access(struct block_device *bdev, sector_t sector,
+ void **kaddr, unsigned long *pfn, long size)
+{
+ struct pmem_device *pmem = bdev->bd_disk->private_data;
+ size_t offset = sector << 9;
+
+ if (unlikely(!pmem))
+ return -ENODEV;
+
+ *kaddr = pmem->virt_addr + offset;
+ *pfn = (pmem->phys_addr + offset) >> PAGE_SHIFT;
+
+ return pmem->size - offset;
+}
+
static const struct block_device_operations pmem_fops = {
.owner = THIS_MODULE,
.rw_page = pmem_rw_page,
+ .direct_access = pmem_direct_access,
};
/* Kernel module stuff */
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists