Commit c14c6fd5 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Theodore Ts'o

ext4: Add EXT4_IOC_MIGRATE ioctl

The below patch add ioctl for migrating ext3 indirect block mapped inode
to ext4 extent mapped inode.
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
parent 25ec56b5
...@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o ...@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o
ext4dev-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ ext4dev-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \ ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \
ext4_jbd2.o ext4_jbd2.o migrate.o
ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o ext4dev-$(CONFIG_EXT4DEV_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL) += acl.o
......
...@@ -61,7 +61,7 @@ static ext4_fsblk_t ext_pblock(struct ext4_extent *ex) ...@@ -61,7 +61,7 @@ static ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
* idx_pblock: * idx_pblock:
* combine low and high parts of a leaf physical block number into ext4_fsblk_t * combine low and high parts of a leaf physical block number into ext4_fsblk_t
*/ */
static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix) ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
{ {
ext4_fsblk_t block; ext4_fsblk_t block;
...@@ -75,7 +75,7 @@ static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix) ...@@ -75,7 +75,7 @@ static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
* stores a large physical block number into an extent struct, * stores a large physical block number into an extent struct,
* breaking it into parts * breaking it into parts
*/ */
static void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb) void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
{ {
ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff)); ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff); ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
......
...@@ -254,6 +254,9 @@ flags_err: ...@@ -254,6 +254,9 @@ flags_err:
return err; return err;
} }
case EXT4_IOC_MIGRATE:
return ext4_ext_migrate(inode, filp, cmd, arg);
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
This diff is collapsed.
...@@ -243,6 +243,7 @@ struct ext4_new_group_data { ...@@ -243,6 +243,7 @@ struct ext4_new_group_data {
#endif #endif
#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) #define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) #define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
#define EXT4_IOC_MIGRATE _IO('f', 7)
/* /*
* ioctl commands in 32 bit emulation * ioctl commands in 32 bit emulation
...@@ -983,6 +984,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int, ...@@ -983,6 +984,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
/* migrate.c */
extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
unsigned long);
/* namei.c */ /* namei.c */
extern int ext4_orphan_add(handle_t *, struct inode *); extern int ext4_orphan_add(handle_t *, struct inode *);
extern int ext4_orphan_del(handle_t *, struct inode *); extern int ext4_orphan_del(handle_t *, struct inode *);
......
...@@ -212,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext) ...@@ -212,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
(le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
} }
extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
extern int ext4_extent_tree_init(handle_t *, struct inode *); extern int ext4_extent_tree_init(handle_t *, struct inode *);
extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
extern int ext4_ext_try_to_merge(struct inode *inode, extern int ext4_ext_try_to_merge(struct inode *inode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment