Commit d11ffa8d authored by Jan Kara's avatar Jan Kara

udf: Convert udf_rmdir() to new directory iteration code

Convert udf_rmdir() to use new directory iteration code.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 4cca7e3d
...@@ -898,30 +898,23 @@ static int empty_dir(struct inode *dir) ...@@ -898,30 +898,23 @@ static int empty_dir(struct inode *dir)
static int udf_rmdir(struct inode *dir, struct dentry *dentry) static int udf_rmdir(struct inode *dir, struct dentry *dentry)
{ {
int retval; int ret;
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct udf_fileident_bh fibh; struct udf_fileident_iter iter;
struct fileIdentDesc *fi, cfi;
struct kernel_lb_addr tloc; struct kernel_lb_addr tloc;
retval = -ENOENT; ret = udf_fiiter_find_entry(dir, &dentry->d_name, &iter);
fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); if (ret)
if (IS_ERR_OR_NULL(fi)) {
if (fi)
retval = PTR_ERR(fi);
goto out; goto out;
}
retval = -EIO; ret = -EFSCORRUPTED;
tloc = lelb_to_cpu(cfi.icb.extLocation); tloc = lelb_to_cpu(iter.fi.icb.extLocation);
if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino) if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino)
goto end_rmdir; goto end_rmdir;
retval = -ENOTEMPTY; ret = -ENOTEMPTY;
if (!empty_dir(inode)) if (!empty_dir(inode))
goto end_rmdir; goto end_rmdir;
retval = udf_delete_entry(dir, fi, &fibh, &cfi); udf_fiiter_delete_entry(&iter);
if (retval)
goto end_rmdir;
if (inode->i_nlink != 2) if (inode->i_nlink != 2)
udf_warn(inode->i_sb, "empty directory has nlink != 2 (%u)\n", udf_warn(inode->i_sb, "empty directory has nlink != 2 (%u)\n",
inode->i_nlink); inode->i_nlink);
...@@ -931,14 +924,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -931,14 +924,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
inode->i_ctime = dir->i_ctime = dir->i_mtime = inode->i_ctime = dir->i_ctime = dir->i_mtime =
current_time(inode); current_time(inode);
mark_inode_dirty(dir); mark_inode_dirty(dir);
ret = 0;
end_rmdir: end_rmdir:
if (fibh.sbh != fibh.ebh) udf_fiiter_release(&iter);
brelse(fibh.ebh);
brelse(fibh.sbh);
out: out:
return retval; return ret;
} }
static int udf_unlink(struct inode *dir, struct dentry *dentry) static int udf_unlink(struct inode *dir, struct dentry *dentry)
......
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