mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 15:19:51 +00:00
ntfs: new export ops
Trivial switch over to the new generic helpers. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Anton Altaparmakov <aia21@cantab.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d425de7043
commit
a35132068a
@ -450,58 +450,40 @@ try_next:
|
|||||||
return parent_dent;
|
return parent_dent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static struct inode *ntfs_nfs_get_inode(struct super_block *sb,
|
||||||
* ntfs_get_dentry - find a dentry for the inode from a file handle sub-fragment
|
u64 ino, u32 generation)
|
||||||
* @sb: super block identifying the mounted ntfs volume
|
|
||||||
* @fh: the file handle sub-fragment
|
|
||||||
*
|
|
||||||
* Find a dentry for the inode given a file handle sub-fragment. This function
|
|
||||||
* is called from fs/exportfs/expfs.c::find_exported_dentry() which in turn is
|
|
||||||
* called from the default ->decode_fh() which is export_decode_fh() in the
|
|
||||||
* same file. The code is closely based on the default ->get_dentry() helper
|
|
||||||
* fs/exportfs/expfs.c::get_object().
|
|
||||||
*
|
|
||||||
* The @fh contains two 32-bit unsigned values, the first one is the inode
|
|
||||||
* number and the second one is the inode generation.
|
|
||||||
*
|
|
||||||
* Return the dentry on success or the error code on error (IS_ERR() is true).
|
|
||||||
*/
|
|
||||||
static struct dentry *ntfs_get_dentry(struct super_block *sb, void *fh)
|
|
||||||
{
|
{
|
||||||
struct inode *vi;
|
struct inode *inode;
|
||||||
struct dentry *dent;
|
|
||||||
unsigned long ino = ((u32 *)fh)[0];
|
|
||||||
u32 gen = ((u32 *)fh)[1];
|
|
||||||
|
|
||||||
ntfs_debug("Entering for inode 0x%lx, generation 0x%x.", ino, gen);
|
inode = ntfs_iget(sb, ino);
|
||||||
vi = ntfs_iget(sb, ino);
|
if (!IS_ERR(inode)) {
|
||||||
if (IS_ERR(vi)) {
|
if (is_bad_inode(inode) || inode->i_generation != generation) {
|
||||||
ntfs_error(sb, "Failed to get inode 0x%lx.", ino);
|
iput(inode);
|
||||||
return (struct dentry *)vi;
|
inode = ERR_PTR(-ESTALE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (unlikely(is_bad_inode(vi) || vi->i_generation != gen)) {
|
|
||||||
/* We didn't find the right inode. */
|
return inode;
|
||||||
ntfs_error(sb, "Inode 0x%lx, bad count: %d %d or version 0x%x "
|
}
|
||||||
"0x%x.", vi->i_ino, vi->i_nlink,
|
|
||||||
atomic_read(&vi->i_count), vi->i_generation,
|
static struct dentry *ntfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
|
||||||
gen);
|
int fh_len, int fh_type)
|
||||||
iput(vi);
|
{
|
||||||
return ERR_PTR(-ESTALE);
|
return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
|
||||||
}
|
ntfs_nfs_get_inode);
|
||||||
/* Now find a dentry. If possible, get a well-connected one. */
|
}
|
||||||
dent = d_alloc_anon(vi);
|
|
||||||
if (unlikely(!dent)) {
|
static struct dentry *ntfs_fh_to_parent(struct super_block *sb, struct fid *fid,
|
||||||
iput(vi);
|
int fh_len, int fh_type)
|
||||||
return ERR_PTR(-ENOMEM);
|
{
|
||||||
}
|
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
|
||||||
ntfs_debug("Done for inode 0x%lx, generation 0x%x.", ino, gen);
|
ntfs_nfs_get_inode);
|
||||||
return dent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export operations allowing NFS exporting of mounted NTFS partitions.
|
* Export operations allowing NFS exporting of mounted NTFS partitions.
|
||||||
*
|
*
|
||||||
* We use the default ->decode_fh() and ->encode_fh() for now. Note that they
|
* We use the default ->encode_fh() for now. Note that they
|
||||||
* use 32 bits to store the inode number which is an unsigned long so on 64-bit
|
* use 32 bits to store the inode number which is an unsigned long so on 64-bit
|
||||||
* architectures is usually 64 bits so it would all fail horribly on huge
|
* architectures is usually 64 bits so it would all fail horribly on huge
|
||||||
* volumes. I guess we need to define our own encode and decode fh functions
|
* volumes. I guess we need to define our own encode and decode fh functions
|
||||||
@ -520,7 +502,6 @@ static struct dentry *ntfs_get_dentry(struct super_block *sb, void *fh)
|
|||||||
struct export_operations ntfs_export_ops = {
|
struct export_operations ntfs_export_ops = {
|
||||||
.get_parent = ntfs_get_parent, /* Find the parent of a given
|
.get_parent = ntfs_get_parent, /* Find the parent of a given
|
||||||
directory. */
|
directory. */
|
||||||
.get_dentry = ntfs_get_dentry, /* Find a dentry for the inode
|
.fh_to_dentry = ntfs_fh_to_dentry,
|
||||||
given a file handle
|
.fh_to_parent = ntfs_fh_to_parent,
|
||||||
sub-fragment. */
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user