Skip to content

Commit b1db9a4

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
NFS: Remove the nfs4_label from the nfs_entry struct
And instead allocate the fattr using nfs_alloc_fattr_with_label() Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent d755ad8 commit b1db9a4

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

fs/nfs/dir.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,8 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry,
682682
nfs_set_verifier(dentry, dir_verifier);
683683
status = nfs_refresh_inode(d_inode(dentry), entry->fattr);
684684
if (!status)
685-
nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label);
685+
nfs_setsecurity(d_inode(dentry), entry->fattr,
686+
entry->fattr->label);
686687
goto out;
687688
} else {
688689
d_invalidate(dentry);
@@ -696,7 +697,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry,
696697
goto out;
697698
}
698699

699-
inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->label);
700+
inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->fattr->label);
700701
alias = d_splice_alias(inode, dentry);
701702
d_lookup_done(dentry);
702703
if (alias) {
@@ -732,8 +733,8 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc,
732733
xdr_set_scratch_page(&stream, scratch);
733734

734735
do {
735-
if (entry->label)
736-
entry->label->len = NFS4_MAXLABELLEN;
736+
if (entry->fattr->label)
737+
entry->fattr->label->len = NFS4_MAXLABELLEN;
737738

738739
status = xdr_decode(desc, entry, &stream);
739740
if (status != 0)
@@ -838,21 +839,15 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
838839
return -ENOMEM;
839840
entry->cookie = nfs_readdir_page_last_cookie(page);
840841
entry->fh = nfs_alloc_fhandle();
841-
entry->fattr = nfs_alloc_fattr();
842+
entry->fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode));
842843
entry->server = NFS_SERVER(inode);
843844
if (entry->fh == NULL || entry->fattr == NULL)
844845
goto out;
845846

846-
entry->label = nfs4_label_alloc(NFS_SERVER(inode), GFP_NOWAIT);
847-
if (IS_ERR(entry->label)) {
848-
status = PTR_ERR(entry->label);
849-
goto out;
850-
}
851-
852847
array_size = (dtsize + PAGE_SIZE - 1) >> PAGE_SHIFT;
853848
pages = nfs_readdir_alloc_pages(array_size);
854849
if (!pages)
855-
goto out_release_label;
850+
goto out;
856851

857852
do {
858853
unsigned int pglen;
@@ -875,8 +870,6 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
875870
} while (!status && nfs_readdir_page_needs_filling(page));
876871

877872
nfs_readdir_free_pages(pages, array_size);
878-
out_release_label:
879-
nfs4_label_free(entry->label);
880873
out:
881874
nfs_free_fattr(entry->fattr);
882875
nfs_free_fhandle(entry->fh);

fs/nfs/nfs4xdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7467,7 +7467,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
74677467
return -EAGAIN;
74687468

74697469
if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh,
7470-
NULL, entry->label, entry->server) < 0)
7470+
NULL, entry->fattr->label, entry->server) < 0)
74717471
return -EAGAIN;
74727472
if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID)
74737473
entry->ino = entry->fattr->mounted_on_fileid;

include/linux/nfs_xdr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,6 @@ struct nfs_entry {
753753
int eof;
754754
struct nfs_fh * fh;
755755
struct nfs_fattr * fattr;
756-
struct nfs4_label *label;
757756
unsigned char d_type;
758757
struct nfs_server * server;
759758
};

0 commit comments

Comments
 (0)