diff options
author | Sage Weil <sage@newdream.net> | 2010-04-16 12:53:43 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-01 23:11:39 -0400 |
commit | 8c6e9229fc1989cf263a6fcd4ff406d7f473f966 (patch) | |
tree | 6402204aae50b0590df39289ed1e533472ee6ca1 /fs/ceph | |
parent | 84d9509234c46481aded977193fcf23f892d715f (diff) |
ceph: add LAZYIO ioctl to mark a file description for lazy consistency
Allow an application to mark a file descriptor for lazy file consistency
semantics, allowing buffered reads and writes when multiple clients are
accessing the same file.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/ioctl.c | 24 | ||||
-rw-r--r-- | fs/ceph/ioctl.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index d085f07756b4..76e307d2aba1 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -143,6 +143,27 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) | |||
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | static long ceph_ioctl_lazyio(struct file *file) | ||
147 | { | ||
148 | struct ceph_file_info *fi = file->private_data; | ||
149 | struct inode *inode = file->f_dentry->d_inode; | ||
150 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
151 | |||
152 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { | ||
153 | spin_lock(&inode->i_lock); | ||
154 | ci->i_nr_by_mode[fi->fmode]--; | ||
155 | fi->fmode |= CEPH_FILE_MODE_LAZY; | ||
156 | ci->i_nr_by_mode[fi->fmode]++; | ||
157 | spin_unlock(&inode->i_lock); | ||
158 | dout("ioctl_layzio: file %p marked lazy\n", file); | ||
159 | |||
160 | ceph_check_caps(ci, 0, NULL); | ||
161 | } else { | ||
162 | dout("ioctl_layzio: file %p already lazy\n", file); | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
146 | long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 167 | long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
147 | { | 168 | { |
148 | dout("ioctl file %p cmd %u arg %lu\n", file, cmd, arg); | 169 | dout("ioctl file %p cmd %u arg %lu\n", file, cmd, arg); |
@@ -155,6 +176,9 @@ long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
155 | 176 | ||
156 | case CEPH_IOC_GET_DATALOC: | 177 | case CEPH_IOC_GET_DATALOC: |
157 | return ceph_ioctl_get_dataloc(file, (void __user *)arg); | 178 | return ceph_ioctl_get_dataloc(file, (void __user *)arg); |
179 | |||
180 | case CEPH_IOC_LAZYIO: | ||
181 | return ceph_ioctl_lazyio(file); | ||
158 | } | 182 | } |
159 | return -ENOTTY; | 183 | return -ENOTTY; |
160 | } | 184 | } |
diff --git a/fs/ceph/ioctl.h b/fs/ceph/ioctl.h index 25e4f1a9d059..88451a3b6857 100644 --- a/fs/ceph/ioctl.h +++ b/fs/ceph/ioctl.h | |||
@@ -37,4 +37,6 @@ struct ceph_ioctl_dataloc { | |||
37 | #define CEPH_IOC_GET_DATALOC _IOWR(CEPH_IOCTL_MAGIC, 3, \ | 37 | #define CEPH_IOC_GET_DATALOC _IOWR(CEPH_IOCTL_MAGIC, 3, \ |
38 | struct ceph_ioctl_dataloc) | 38 | struct ceph_ioctl_dataloc) |
39 | 39 | ||
40 | #define CEPH_IOC_LAZYIO _IO(CEPH_IOCTL_MAGIC, 4) | ||
41 | |||
40 | #endif | 42 | #endif |