#include <linux/parser.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
+#include <linux/exportfs.h>
#include "ubifs.h"
/* Slab cache for UBIFS inodes */
if (err)
goto out_invalid;
- /* Disable readahead */
+ /* Disable read-ahead */
inode->i_mapping->backing_dev_info = &c->bdi;
switch (inode->i_mode & S_IFMT) {
if (err)
/*
* Worst case we have a lost orphan inode wasting space, so a
- * simple error message is ok here.
+ * simple error message is OK here.
*/
ubifs_err("can't delete inode %lu, error %d",
inode->i_ino, err);
.sync_fs = ubifs_sync_fs,
};
+/*
+ * Note, since UBIFS does re-use inode numbers at the moment, we do not check
+ * the generation number in this function.
+ */
+static struct dentry *ubifs_fh_to_dentry(struct super_block *sb,
+ struct fid *fid,
+ int fh_len, int fh_type)
+{
+ ino_t inum;
+ struct inode *inode;
+ struct dentry *dent;
+
+ switch (fh_type) {
+ case FILEID_INO32_GEN:
+ case FILEID_INO32_GEN_PARENT:
+ inum = fid->i32.ino;
+ break;
+ default:
+ dbg_err("unsupported file handle type %d", fh_type);
+ return ERR_PTR(-EINVAL);
+ }
+
+ inode = ubifs_iget(sb, inum);
+ if (IS_ERR(inode)) {
+ if (PTR_ERR(inode) == -ENOENT)
+ return ERR_PTR(-ESTALE);
+ return ERR_CAST(inode);
+ }
+
+ dent = d_alloc_anon(inode);
+ if (!dent) {
+ iput(inode);
+ return ERR_PTR(-ENOMEM);
+ }
+ return dent;
+}
+
+/*
+ * Probably NFS support could be faster if other export operations were
+ * implemented, but '->fh_to_dentry()' is enough.
+ */
+static struct export_operations ubifs_export_ops = {
+ .fh_to_dentry = ubifs_fh_to_dentry,
+};
+
/**
* open_ubi - parse UBI device name string and open the UBI device.
* @name: UBI volume name
}
/*
- * UBIFS provids 'backing_dev_info' in order to disable readahead. For
+ * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For
* UBIFS, I/O is not deferred, it is done immediately in readpage,
* which means the user would have to wait not just for their own I/O
- * but the readahead I/O as well i.e. completely pointless.
+ * but the read-ahead I/O as well i.e. completely pointless.
*
* Read-ahead will be disabled because @c->bdi.ra_pages is 0.
*/
if (c->max_inode_sz > MAX_LFS_FILESIZE)
sb->s_maxbytes = c->max_inode_sz = MAX_LFS_FILESIZE;
sb->s_op = &ubifs_super_operations;
+ sb->s_export_op = &ubifs_export_ops;
mutex_lock(&c->umount_mutex);
err = mount_ubifs(c);
}
static struct file_system_type ubifs_fs_type = {
- .name = "ubifs",
- .owner = THIS_MODULE,
- .get_sb = ubifs_get_sb,
- .kill_sb = ubifs_kill_sb
+ .name = "ubifs",
+ .owner = THIS_MODULE,
+ .get_sb = ubifs_get_sb,
+ .kill_sb = ubifs_kill_sb,
+ .fs_flags = FS_REQUIRES_DEV,
};
/*