Skip to content

Commit

Permalink
ext4 crypto: export ext4_empty_dir()
Browse files Browse the repository at this point in the history
Required for future encryption xattr changes.

Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Michael Halcrow authored and Theodore Ts'o committed Apr 11, 2015
1 parent b17655f commit e875a2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,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,
Expand Down
11 changes: 6 additions & 5 deletions fs/ext4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
/*
* 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;
Expand Down Expand Up @@ -2725,7 +2725,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,
Expand Down Expand Up @@ -3285,7 +3285,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;
Expand Down Expand Up @@ -3359,8 +3359,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);
Expand Down

0 comments on commit e875a2d

Please sign in to comment.