[PATCH] get rid of on-stack dentry in udf
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Oct 2008 04:15:17 +0000 (00:15 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 23 Oct 2008 09:13:15 +0000 (05:13 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/udf/namei.c

index 7578fae12d3c1cff0bf3743e7b0afe2a82cb2bbe..082409cd4b8aec78918c697cc4666fe937cb26be 100644 (file)
@@ -142,7 +142,7 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
 }
 
 static struct fileIdentDesc *udf_find_entry(struct inode *dir,
-                                           struct dentry *dentry,
+                                           struct qstr *child,
                                            struct udf_fileident_bh *fibh,
                                            struct fileIdentDesc *cfi)
 {
@@ -159,8 +159,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
        sector_t offset;
        struct extent_position epos = {};
        struct udf_inode_info *dinfo = UDF_I(dir);
-       int isdotdot = dentry->d_name.len == 2 &&
-               dentry->d_name.name[0] == '.' && dentry->d_name.name[1] == '.';
+       int isdotdot = child->len == 2 &&
+               child->name[0] == '.' && child->name[1] == '.';
 
        size = udf_ext0_offset(dir) + dir->i_size;
        f_pos = udf_ext0_offset(dir);
@@ -238,8 +238,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
                        continue;
 
                flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
-               if (flen && udf_match(flen, fname, dentry->d_name.len,
-                                     dentry->d_name.name))
+               if (flen && udf_match(flen, fname, child->len, child->name))
                        goto out_ok;
        }
 
@@ -283,7 +282,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
        } else
 #endif /* UDF_RECOVERY */
 
-       if (udf_find_entry(dir, dentry, &fibh, &cfi)) {
+       if (udf_find_entry(dir, &dentry->d_name, &fibh, &cfi)) {
                if (fibh.sbh != fibh.ebh)
                        brelse(fibh.ebh);
                brelse(fibh.sbh);
@@ -783,7 +782,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
 
        retval = -ENOENT;
        lock_kernel();
-       fi = udf_find_entry(dir, dentry, &fibh, &cfi);
+       fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
        if (!fi)
                goto out;
 
@@ -829,7 +828,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
 
        retval = -ENOENT;
        lock_kernel();
-       fi = udf_find_entry(dir, dentry, &fibh, &cfi);
+       fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
        if (!fi)
                goto out;
 
@@ -1113,7 +1112,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct udf_inode_info *old_iinfo = UDF_I(old_inode);
 
        lock_kernel();
-       ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi);
+       ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
        if (ofi) {
                if (ofibh.sbh != ofibh.ebh)
                        brelse(ofibh.ebh);
@@ -1124,7 +1123,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
            != old_inode->i_ino)
                goto end_rename;
 
-       nfi = udf_find_entry(new_dir, new_dentry, &nfibh, &ncfi);
+       nfi = udf_find_entry(new_dir, &new_dentry->d_name, &nfibh, &ncfi);
        if (nfi) {
                if (!new_inode) {
                        if (nfibh.sbh != nfibh.ebh)
@@ -1192,7 +1191,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
        udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL);
 
        /* The old fid may have moved - find it again */
-       ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi);
+       ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
        udf_delete_entry(old_dir, ofi, &ofibh, &ocfi);
 
        if (new_inode) {
@@ -1244,13 +1243,10 @@ end_rename:
 static struct dentry *udf_get_parent(struct dentry *child)
 {
        struct inode *inode = NULL;
-       struct dentry dotdot;
+       struct qstr dotdot = {.name = "..", .len = 2};
        struct fileIdentDesc cfi;
        struct udf_fileident_bh fibh;
 
-       dotdot.d_name.name = "..";
-       dotdot.d_name.len = 2;
-
        lock_kernel();
        if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi))
                goto out_unlock;