aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-10-08 19:44:18 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-08 19:44:18 -0400
commitc4b929b85bdb64afacbbf6453b1f2bf7e14c9e89 (patch)
tree6f5a4b1378d7b609d0f1ceab93fb501cf91b218a /include/linux/fs.h
parent4d20c685fa365766a8f13584b4c8178a15ab7103 (diff)
vfs: vfs-level fiemap interface
Basic vfs-level fiemap infrastructure, which sets up a new ->fiemap inode operation. Userspace can get extent information on a file via fiemap ioctl. As input, the fiemap ioctl takes a struct fiemap which includes an array of struct fiemap_extent (fm_extents). Size of the extent array is passed as fm_extent_count and number of extents returned will be written into fm_mapped_extents. Offset and length fields on the fiemap structure (fm_start, fm_length) describe a logical range which will be searched for extents. All extents returned will at least partially contain this range. The actual extent offsets and ranges returned will be unmodified from their offset and range on-disk. The fiemap ioctl returns '0' on success. On error, -1 is returned and errno is set. If errno is equal to EBADR, then fm_flags will contain those flags which were passed in which the kernel did not understand. On all other errors, the contents of fm_extents is undefined. As fiemap evolved, there have been many authors of the vfs patch. As far as I can tell, the list includes: Kalpak Shah <kalpak.shah@sun.com> Andreas Dilger <adilger@sun.com> Eric Sandeen <sandeen@redhat.com> Mark Fasheh <mfasheh@suse.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Michael Kerrisk <mtk.manpages@googlemail.com> Cc: linux-api@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 580b513668fe..194fb237a307 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -231,6 +231,7 @@ extern int dir_notify_enable;
231#define FS_IOC_SETFLAGS _IOW('f', 2, long) 231#define FS_IOC_SETFLAGS _IOW('f', 2, long)
232#define FS_IOC_GETVERSION _IOR('v', 1, long) 232#define FS_IOC_GETVERSION _IOR('v', 1, long)
233#define FS_IOC_SETVERSION _IOW('v', 2, long) 233#define FS_IOC_SETVERSION _IOW('v', 2, long)
234#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
234#define FS_IOC32_GETFLAGS _IOR('f', 1, int) 235#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
235#define FS_IOC32_SETFLAGS _IOW('f', 2, int) 236#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
236#define FS_IOC32_GETVERSION _IOR('v', 1, int) 237#define FS_IOC32_GETVERSION _IOR('v', 1, int)
@@ -291,6 +292,7 @@ extern int dir_notify_enable;
291#include <linux/mutex.h> 292#include <linux/mutex.h>
292#include <linux/capability.h> 293#include <linux/capability.h>
293#include <linux/semaphore.h> 294#include <linux/semaphore.h>
295#include <linux/fiemap.h>
294 296
295#include <asm/atomic.h> 297#include <asm/atomic.h>
296#include <asm/byteorder.h> 298#include <asm/byteorder.h>
@@ -1179,6 +1181,20 @@ extern void dentry_unhash(struct dentry *dentry);
1179extern int file_permission(struct file *, int); 1181extern int file_permission(struct file *, int);
1180 1182
1181/* 1183/*
1184 * VFS FS_IOC_FIEMAP helper definitions.
1185 */
1186struct fiemap_extent_info {
1187 unsigned int fi_flags; /* Flags as passed from user */
1188 unsigned int fi_extents_mapped; /* Number of mapped extents */
1189 unsigned int fi_extents_max; /* Size of fiemap_extent array */
1190 struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent
1191 * array */
1192};
1193int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
1194 u64 phys, u64 len, u32 flags);
1195int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1196
1197/*
1182 * File types 1198 * File types
1183 * 1199 *
1184 * NOTE! These match bits 12..15 of stat.st_mode 1200 * NOTE! These match bits 12..15 of stat.st_mode
@@ -1287,6 +1303,8 @@ struct inode_operations {
1287 void (*truncate_range)(struct inode *, loff_t, loff_t); 1303 void (*truncate_range)(struct inode *, loff_t, loff_t);
1288 long (*fallocate)(struct inode *inode, int mode, loff_t offset, 1304 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1289 loff_t len); 1305 loff_t len);
1306 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1307 u64 len);
1290}; 1308};
1291 1309
1292struct seq_file; 1310struct seq_file;