ext4 crypto: export ext4_empty_dir()
Michael Halcrow [Mon, 13 Apr 2015 03:50:45 +0000 (23:50 -0400)]
Required for future encryption xattr changes.

Change-Id: I40325ae4d7509104e1482d3404ebc6d43e678b6a
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

fs/ext4/ext4.h
fs/ext4/namei.c

index b6ae2ba..112e3a8 100644 (file)
@@ -2193,6 +2193,7 @@ extern int ext4_generic_delete_entry(handle_t *handle,
                                     void *entry_buf,
                                     int buf_size,
                                     int csum_size);
+extern int ext4_empty_dir(struct inode *inode);
 
 /* resize.c */
 extern int ext4_group_add(struct super_block *sb,
index 4128da9..422f4ab 100644 (file)
@@ -2454,7 +2454,7 @@ out_stop:
 /*
  * routine to check that the specified directory is empty (for rmdir)
  */
-static int empty_dir(struct inode *inode)
+int ext4_empty_dir(struct inode *inode)
 {
        unsigned int offset;
        struct buffer_head *bh;
@@ -2722,7 +2722,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
                goto end_rmdir;
 
        retval = -ENOTEMPTY;
-       if (!empty_dir(inode))
+       if (!ext4_empty_dir(inode))
                goto end_rmdir;
 
        handle = ext4_journal_start(dir, EXT4_HT_DIR,
@@ -3288,7 +3288,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
        if (S_ISDIR(old.inode->i_mode)) {
                if (new.inode) {
                        retval = -ENOTEMPTY;
-                       if (!empty_dir(new.inode))
+                       if (!ext4_empty_dir(new.inode))
                                goto end_rename;
                } else {
                        retval = -EMLINK;
@@ -3362,8 +3362,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 
                ext4_dec_count(handle, old.dir);
                if (new.inode) {
-                       /* checked empty_dir above, can't have another parent,
-                        * ext4_dec_count() won't work for many-linked dirs */
+                       /* checked ext4_empty_dir above, can't have another
+                        * parent, ext4_dec_count() won't work for many-linked
+                        * dirs */
                        clear_nlink(new.inode);
                } else {
                        ext4_inc_count(handle, new.dir);