Viewing: ext4-osd-iop-common.patch
commit bb3dff04ddbbf9a647641d98e293fdf014719313
Author: Rahul Deshmukh <deshmukh@clusterfs.com>
AuthorDate: Wed Nov 19 06:47:42 2008 +0000
ldiskfs: add interface for direct inode/dentry operations
Allow osd-ldiskfs operations to directly allocate inodes without
directory entries, and remove directory entries without deleting
the inode. This allows osd-ldiskfs on the MDT to add and remove
remote directory entries more easily for remote DNE directory
and hard link operations as part of compound operations.
The entries in the filesystem will remain consistent at the end
of every transaction.
Bugzilla-ID: b=11826
Signed-off-by: Rahul Deshmukh <deshmukh@clusterfs.com>
Reviewed-by: Nikita Danilov <nikita@clusterfs.com>
Reviewed-by: Andreas Dilger <adilger@clusterfs.com>
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index d7332df..72c4d1a 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3084,6 +3084,12 @@ extern int ext4_dirblock_csum_verify(struct inode *inode,
struct buffer_head *bh);
extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
__u32 start_minor_hash, __u32 *next_hash);
+extern struct inode *ext4_create_inode(handle_t *handle,
+ struct inode *dir, int mode,
+ uid_t *owner);
+extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
+ struct ext4_dir_entry_2 *de_del,
+ struct buffer_head *bh);
extern int ext4_search_dir(struct buffer_head *bh,
char *search_buf,
int buf_size,
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 249836e..91467a1 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2651,7 +2651,7 @@ int ext4_generic_delete_entry(struct inode *dir,
return -ENOENT;
}
-static int ext4_delete_entry(handle_t *handle,
+int ext4_delete_entry(handle_t *handle,
struct inode *dir,
struct ext4_dir_entry_2 *de_del,
struct buffer_head *bh)
@@ -2691,7 +2691,7 @@ out:
ext4_std_error(dir->i_sb, err);
return err;
}
-
+EXPORT_SYMBOL(ext4_delete_entry);
/*
* Set directory link count to 1 if nlinks > EXT4_LINK_MAX, or if nlinks == 2
* since this indicates that nlinks count was previously 1 to avoid overflowing
@@ -2748,6 +2748,29 @@ static int ext4_add_nondir(handle_t *handle,
return err;
}
+ /* Return locked inode, then the caller can modify the inode's states/flags
+ * before others finding it. The caller should unlock the inode by itself. */
+struct inode *ext4_create_inode(handle_t *handle, struct inode *dir, int mode,
+ uid_t *owner)
+{
+ struct inode *inode;
+
+ inode = ext4_new_inode(handle, dir, mode, NULL, 0, owner, 0);
+ if (!IS_ERR(inode)) {
+ if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
+#ifdef CONFIG_LDISKFS_FS_XATTR
+ inode->i_op = &ext4_special_inode_operations;
+#endif
+ } else {
+ inode->i_op = &ext4_file_inode_operations;
+ inode->i_fop = &ext4_file_operations;
+ ext4_set_aops(inode);
+ }
+ }
+ return inode;
+}
+EXPORT_SYMBOL(ext4_create_inode);
+
/*
* By the time this is called, we already have created
* the directory cache entry for the new file, but it
--
2.27.0