aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ioctl.c
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2009-09-20 23:25:14 -0400
committerJoel Becker <joel.becker@oracle.com>2009-09-22 23:09:51 -0400
commitbd50873dc725a9fa72592ecc986c58805e823051 (patch)
tree8d2d4d514f73b6425bf0bf5bd1806949b84a2489 /fs/ocfs2/ioctl.c
parent64871b8d62570fabec3b0959d494f8e0b87f5c4b (diff)
ocfs2: Add ioctl for reflink.
The ioctl will take 3 parameters: old_path, new_path and preserve and call vfs_reflink. It is useful when we backport reflink features to old kernels. Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2/ioctl.c')
-rw-r--r--fs/ocfs2/ioctl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 9fcd36dcc9a0..a68d0e4ca6dc 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -22,6 +22,7 @@
22#include "ocfs2_fs.h" 22#include "ocfs2_fs.h"
23#include "ioctl.h" 23#include "ioctl.h"
24#include "resize.h" 24#include "resize.h"
25#include "refcounttree.h"
25 26
26#include <linux/ext2_fs.h> 27#include <linux/ext2_fs.h>
27 28
@@ -116,6 +117,9 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
116 int status; 117 int status;
117 struct ocfs2_space_resv sr; 118 struct ocfs2_space_resv sr;
118 struct ocfs2_new_group_input input; 119 struct ocfs2_new_group_input input;
120 struct reflink_arguments args;
121 const char *old_path, *new_path;
122 bool preserve;
119 123
120 switch (cmd) { 124 switch (cmd) {
121 case OCFS2_IOC_GETFLAGS: 125 case OCFS2_IOC_GETFLAGS:
@@ -161,6 +165,15 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
161 return -EFAULT; 165 return -EFAULT;
162 166
163 return ocfs2_group_add(inode, &input); 167 return ocfs2_group_add(inode, &input);
168 case OCFS2_IOC_REFLINK:
169 if (copy_from_user(&args, (struct reflink_arguments *)arg,
170 sizeof(args)))
171 return -EFAULT;
172 old_path = (const char *)(unsigned long)args.old_path;
173 new_path = (const char *)(unsigned long)args.new_path;
174 preserve = (args.preserve != 0);
175
176 return ocfs2_reflink_ioctl(inode, old_path, new_path, preserve);
164 default: 177 default:
165 return -ENOTTY; 178 return -ENOTTY;
166 } 179 }
@@ -183,6 +196,7 @@ long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
183 case OCFS2_IOC_GROUP_EXTEND: 196 case OCFS2_IOC_GROUP_EXTEND:
184 case OCFS2_IOC_GROUP_ADD: 197 case OCFS2_IOC_GROUP_ADD:
185 case OCFS2_IOC_GROUP_ADD64: 198 case OCFS2_IOC_GROUP_ADD64:
199 case OCFS2_IOC_REFLINK:
186 break; 200 break;
187 default: 201 default:
188 return -ENOIOCTLCMD; 202 return -ENOIOCTLCMD;