summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-02-03 14:09:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 15:52:48 -0800
commit4d3773c4bb41ed5228f1ab7a4a52b79e17b10515 (patch)
tree71c30d7009b36d22e9aab816f3dc7e373bb5f1e9 /include
parentd35258ef702cca0c4e66d799f8e38b78c02ce8a5 (diff)
downloadlinux-stable-4d3773c4bb41ed5228f1ab7a4a52b79e17b10515.tar.gz
linux-stable-4d3773c4bb41ed5228f1ab7a4a52b79e17b10515.tar.bz2
linux-stable-4d3773c4bb41ed5228f1ab7a4a52b79e17b10515.zip
kernfs: implement kernfs_ops->atomic_write_len
A write to a kernfs_node is buffered through a kernel buffer. Writes <= PAGE_SIZE are performed atomically, while larger ones are executed in PAGE_SIZE chunks. While this is enough for sysfs, cgroup which is scheduled to be converted to use kernfs needs a bit more control over it. This patch adds kernfs_ops->atomic_write_len. If not set (zero), the behavior stays the same. If set, writes upto the size are executed atomically and larger writes are rejected with -E2BIG. A different implementation strategy would be allowing configuring chunking size while making the original write size available to the write method; however, such strategy, while being more complicated, doesn't really buy anything. If the write implementation has to handle chunking, the specific chunk size shouldn't matter all that much. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kernfs.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 4520c86f5cb4..47f5235a097a 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -178,9 +178,13 @@ struct kernfs_ops {
loff_t off);
/*
- * write() is bounced through kernel buffer and a write larger than
- * PAGE_SIZE results in partial operation of PAGE_SIZE.
+ * write() is bounced through kernel buffer. If atomic_write_len
+ * is not set, a write larger than PAGE_SIZE results in partial
+ * operations of PAGE_SIZE chunks. If atomic_write_len is set,
+ * writes upto the specified size are executed atomically but
+ * larger ones are rejected with -E2BIG.
*/
+ size_t atomic_write_len;
ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
loff_t off);