udf: Convert udf_link() to new directory iteration code
Convert udf_link() to use new directory iteration code for adding entry into the directory. Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
00bce6f792
commit
dbfb102d16
|
@ -1222,27 +1222,21 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
|
||||||
struct dentry *dentry)
|
struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(old_dentry);
|
struct inode *inode = d_inode(old_dentry);
|
||||||
struct udf_fileident_bh fibh;
|
struct udf_fileident_iter iter;
|
||||||
struct fileIdentDesc cfi, *fi;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
|
err = udf_fiiter_add_entry(dir, dentry, &iter);
|
||||||
if (!fi) {
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
iter.fi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
|
||||||
cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
|
iter.fi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location);
|
||||||
cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location);
|
|
||||||
if (UDF_SB(inode->i_sb)->s_lvid_bh) {
|
if (UDF_SB(inode->i_sb)->s_lvid_bh) {
|
||||||
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
|
*(__le32 *)((struct allocDescImpUse *)iter.fi.icb.impUse)->impUse =
|
||||||
cpu_to_le32(lvid_get_unique_id(inode->i_sb));
|
cpu_to_le32(lvid_get_unique_id(inode->i_sb));
|
||||||
}
|
}
|
||||||
udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
|
udf_fiiter_write_fi(&iter, NULL);
|
||||||
if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
|
udf_fiiter_release(&iter);
|
||||||
mark_inode_dirty(dir);
|
|
||||||
|
|
||||||
if (fibh.sbh != fibh.ebh)
|
|
||||||
brelse(fibh.ebh);
|
|
||||||
brelse(fibh.sbh);
|
|
||||||
inc_nlink(inode);
|
inc_nlink(inode);
|
||||||
inode->i_ctime = current_time(inode);
|
inode->i_ctime = current_time(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
Loading…
Reference in New Issue