diff options
author | Jan Kara <jack@suse.cz> | 2022-10-05 19:36:49 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-09 10:39:52 +0100 |
commit | 6ec01a8020b54e278fecd1efe8603f8eb38fed84 (patch) | |
tree | f8ff42866b83fb19f9dcefa443e2df5e0e024388 /fs/udf/namei.c | |
parent | d11ffa8d3ec11fdb665f12f95d58d74673051a93 (diff) | |
download | linux-6ec01a8020b54e278fecd1efe8603f8eb38fed84.tar.gz linux-6ec01a8020b54e278fecd1efe8603f8eb38fed84.tar.bz2 linux-6ec01a8020b54e278fecd1efe8603f8eb38fed84.zip |
udf: Convert udf_unlink() to new directory iteration code
Convert udf_unlink() to new directory iteration code.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r-- | fs/udf/namei.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 703303562778..d0ffd2083519 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -933,24 +933,17 @@ out: static int udf_unlink(struct inode *dir, struct dentry *dentry) { - int retval; + int ret; struct inode *inode = d_inode(dentry); - struct udf_fileident_bh fibh; - struct fileIdentDesc *fi; - struct fileIdentDesc cfi; + struct udf_fileident_iter iter; struct kernel_lb_addr tloc; - retval = -ENOENT; - fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); - - if (IS_ERR_OR_NULL(fi)) { - if (fi) - retval = PTR_ERR(fi); + ret = udf_fiiter_find_entry(dir, &dentry->d_name, &iter); + if (ret) goto out; - } - retval = -EIO; - tloc = lelb_to_cpu(cfi.icb.extLocation); + ret = -EFSCORRUPTED; + tloc = lelb_to_cpu(iter.fi.icb.extLocation); if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino) goto end_unlink; @@ -959,22 +952,16 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) inode->i_ino, inode->i_nlink); set_nlink(inode, 1); } - retval = udf_delete_entry(dir, fi, &fibh, &cfi); - if (retval) - goto end_unlink; + udf_fiiter_delete_entry(&iter); dir->i_ctime = dir->i_mtime = current_time(dir); mark_inode_dirty(dir); inode_dec_link_count(inode); inode->i_ctime = dir->i_ctime; - retval = 0; - + ret = 0; end_unlink: - if (fibh.sbh != fibh.ebh) - brelse(fibh.ebh); - brelse(fibh.sbh); - + udf_fiiter_release(&iter); out: - return retval; + return ret; } static int udf_symlink(struct user_namespace *mnt_userns, struct inode *dir, |