aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-12 18:43:34 -0500
committerMark Fasheh <mfasheh@suse.com>2009-04-03 14:39:15 -0400
commit4a12ca3a00a244e1fd1e673d151ea38b71e11d55 (patch)
tree84e30310a7d93ead9910f761e19d3fe73c5861b3 /fs/ocfs2/dir.h
parent59b526a30722f29e5dba6210a6e0fc34e3149b94 (diff)
ocfs2: Introduce dir lookup helper struct
Many directory manipulation calls pass around a tuple of dirent, and it's containing buffer_head. Dir indexing has a bit more state, but instead of adding yet more arguments to functions, we introduce 'struct ocfs2_dir_lookup_result'. In this patch, it simply holds the same tuple, but future patches will add more state. Signed-off-by: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.h')
-rw-r--r--fs/ocfs2/dir.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h
index c511e2e18e9f..505d3af9bba5 100644
--- a/fs/ocfs2/dir.h
+++ b/fs/ocfs2/dir.h
@@ -26,44 +26,48 @@
26#ifndef OCFS2_DIR_H 26#ifndef OCFS2_DIR_H
27#define OCFS2_DIR_H 27#define OCFS2_DIR_H
28 28
29struct buffer_head *ocfs2_find_entry(const char *name, 29struct ocfs2_dir_lookup_result {
30 int namelen, 30 struct buffer_head *dl_leaf_bh;
31 struct inode *dir, 31 struct ocfs2_dir_entry *dl_entry;
32 struct ocfs2_dir_entry **res_dir); 32};
33void ocfs2_free_dir_lookup_result(struct ocfs2_dir_lookup_result *res);
34
35int ocfs2_find_entry(const char *name, int namelen,
36 struct inode *dir,
37 struct ocfs2_dir_lookup_result *lookup);
33int ocfs2_delete_entry(handle_t *handle, 38int ocfs2_delete_entry(handle_t *handle,
34 struct inode *dir, 39 struct inode *dir,
35 struct ocfs2_dir_entry *de_del, 40 struct ocfs2_dir_lookup_result *res);
36 struct buffer_head *bh);
37int __ocfs2_add_entry(handle_t *handle, 41int __ocfs2_add_entry(handle_t *handle,
38 struct inode *dir, 42 struct inode *dir,
39 const char *name, int namelen, 43 const char *name, int namelen,
40 struct inode *inode, u64 blkno, 44 struct inode *inode, u64 blkno,
41 struct buffer_head *parent_fe_bh, 45 struct buffer_head *parent_fe_bh,
42 struct buffer_head *insert_bh); 46 struct ocfs2_dir_lookup_result *lookup);
43static inline int ocfs2_add_entry(handle_t *handle, 47static inline int ocfs2_add_entry(handle_t *handle,
44 struct dentry *dentry, 48 struct dentry *dentry,
45 struct inode *inode, u64 blkno, 49 struct inode *inode, u64 blkno,
46 struct buffer_head *parent_fe_bh, 50 struct buffer_head *parent_fe_bh,
47 struct buffer_head *insert_bh) 51 struct ocfs2_dir_lookup_result *lookup)
48{ 52{
49 return __ocfs2_add_entry(handle, dentry->d_parent->d_inode, 53 return __ocfs2_add_entry(handle, dentry->d_parent->d_inode,
50 dentry->d_name.name, dentry->d_name.len, 54 dentry->d_name.name, dentry->d_name.len,
51 inode, blkno, parent_fe_bh, insert_bh); 55 inode, blkno, parent_fe_bh, lookup);
52} 56}
53int ocfs2_update_entry(struct inode *dir, handle_t *handle, 57int ocfs2_update_entry(struct inode *dir, handle_t *handle,
54 struct buffer_head *de_bh, struct ocfs2_dir_entry *de, 58 struct ocfs2_dir_lookup_result *res,
55 struct inode *new_entry_inode); 59 struct inode *new_entry_inode);
56 60
57int ocfs2_check_dir_for_entry(struct inode *dir, 61int ocfs2_check_dir_for_entry(struct inode *dir,
58 const char *name, 62 const char *name,
59 int namelen); 63 int namelen);
60int ocfs2_empty_dir(struct inode *inode); 64int ocfs2_empty_dir(struct inode *inode);
65
61int ocfs2_find_files_on_disk(const char *name, 66int ocfs2_find_files_on_disk(const char *name,
62 int namelen, 67 int namelen,
63 u64 *blkno, 68 u64 *blkno,
64 struct inode *inode, 69 struct inode *inode,
65 struct buffer_head **dirent_bh, 70 struct ocfs2_dir_lookup_result *res);
66 struct ocfs2_dir_entry **dirent);
67int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name, 71int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name,
68 int namelen, u64 *blkno); 72 int namelen, u64 *blkno);
69int ocfs2_readdir(struct file *filp, void *dirent, filldir_t filldir); 73int ocfs2_readdir(struct file *filp, void *dirent, filldir_t filldir);
@@ -74,7 +78,7 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
74 struct buffer_head *parent_fe_bh, 78 struct buffer_head *parent_fe_bh,
75 const char *name, 79 const char *name,
76 int namelen, 80 int namelen,
77 struct buffer_head **ret_de_bh); 81 struct ocfs2_dir_lookup_result *lookup);
78struct ocfs2_alloc_context; 82struct ocfs2_alloc_context;
79int ocfs2_fill_new_dir(struct ocfs2_super *osb, 83int ocfs2_fill_new_dir(struct ocfs2_super *osb,
80 handle_t *handle, 84 handle_t *handle,