Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1253995
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations |
| Date | 2015-10-22 19:20 +0200 |
| Message-ID | <qmrGX-BA-31@gated-at.bofh.it> (permalink) |
| References | <qmrGW-BA-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
dax_clear_blocks is currently performing a cond_resched() after every
PAGE_SIZE memset. We need not check so frequently, for example md-raid
only calls cond_resched() at stripe granularity. Also, in preparation
for introducing a dax_map_atomic() operation that temporarily pins a dax
mapping move the call to cond_resched() to the outer loop.
Reviewed-by: Jan Kara <jack@suse.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
fs/dax.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index 5dc33d788d50..f8e543839e5c 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -28,6 +28,7 @@
#include <linux/sched.h>
#include <linux/uio.h>
#include <linux/vmstat.h>
+#include <linux/sizes.h>
int dax_clear_blocks(struct inode *inode, sector_t block, long size)
{
@@ -38,24 +39,20 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long size)
do {
void __pmem *addr;
unsigned long pfn;
- long count;
+ long count, sz;
- count = bdev_direct_access(bdev, sector, &addr, &pfn, size);
+ sz = min_t(long, size, SZ_1M);
+ count = bdev_direct_access(bdev, sector, &addr, &pfn, sz);
if (count < 0)
return count;
- BUG_ON(size < count);
- while (count > 0) {
- unsigned pgsz = PAGE_SIZE - offset_in_page(addr);
- if (pgsz > count)
- pgsz = count;
- clear_pmem(addr, pgsz);
- addr += pgsz;
- size -= pgsz;
- count -= pgsz;
- BUG_ON(pgsz & 511);
- sector += pgsz / 512;
- cond_resched();
- }
+ if (count < sz)
+ sz = count;
+ clear_pmem(addr, sz);
+ addr += sz;
+ size -= sz;
+ BUG_ON(sz & 511);
+ sector += sz / 512;
+ cond_resched();
} while (size);
wmb_pmem();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/5] block, dax: updates for 4.4 Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
[PATCH v2 5/5] block: enable dax for raw block devices Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
Re: [PATCH v2 5/5] block: enable dax for raw block devices Jeff Moyer <jmoyer@redhat.com> - 2015-10-28 22:00 +0100
Re: [PATCH v2 5/5] block: enable dax for raw block devices Dan Williams <dan.j.williams@intel.com> - 2015-10-29 08:20 +0100
[PATCH v2 4/5] block: introduce bdev_file_inode() Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
Re: [PATCH v2 4/5] block: introduce bdev_file_inode() Jan Kara <jack@suse.cz> - 2015-10-22 22:40 +0200
Re: [PATCH v2 4/5] block: introduce bdev_file_inode() Jeff Moyer <jmoyer@redhat.com> - 2015-10-28 21:20 +0100
[PATCH v2 3/5] block, dax: fix lifetime of in-kernel dax mappings with dax_map_atomic() Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
Re: [PATCH v2 3/5] block, dax: fix lifetime of in-kernel dax mappings with dax_map_atomic() Jeff Moyer <jmoyer@redhat.com> - 2015-10-28 21:20 +0100
[PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
Re: [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations Jeff Moyer <jmoyer@redhat.com> - 2015-10-22 23:10 +0200
Re: [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations "Williams, Dan J" <dan.j.williams@intel.com> - 2015-10-23 01:00 +0200
Re: [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations Jeff Moyer <jmoyer@redhat.com> - 2015-10-28 22:10 +0100
[PATCH v2 1/5] pmem, dax: clean up clear_pmem() Dan Williams <dan.j.williams@intel.com> - 2015-10-22 19:20 +0200
Re: [PATCH v2 1/5] pmem, dax: clean up clear_pmem() Jeff Moyer <jmoyer@redhat.com> - 2015-10-22 22:50 +0200
Re: [PATCH v2 1/5] pmem, dax: clean up clear_pmem() Dan Williams <dan.j.williams@intel.com> - 2015-10-23 00:30 +0200
Re: [PATCH v2 1/5] pmem, dax: clean up clear_pmem() Jeff Moyer <jmoyer@redhat.com> - 2015-10-28 22:10 +0100
Re: [PATCH v2 1/5] pmem, dax: clean up clear_pmem() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-10-27 18:40 +0100
csiph-web