45 #define NILFS_FID_SIZE_NON_CONNECTABLE \
46 (offsetof(struct nilfs_fid, parent_gen) / 4)
47 #define NILFS_FID_SIZE_CONNECTABLE (sizeof(struct nilfs_fid) / 4)
56 inode_dec_link_count(inode);
87 static int nilfs_create(
struct inode *dir,
struct dentry *dentry,
umode_t mode,
104 err = nilfs_add_nondir(dentry, inode);
115 nilfs_mknod(
struct inode *dir,
struct dentry *dentry,
umode_t mode,
dev_t rdev)
121 if (!new_valid_dev(rdev))
128 err = PTR_ERR(inode);
129 if (!IS_ERR(inode)) {
132 err = nilfs_add_nondir(dentry, inode);
142 static int nilfs_symlink(
struct inode *dir,
struct dentry *dentry,
147 unsigned l =
strlen(symname)+1;
159 err = PTR_ERR(inode);
173 err = nilfs_add_nondir(dentry, inode);
189 static int nilfs_link(
struct dentry *old_dentry,
struct inode *dir,
190 struct dentry *dentry)
192 struct inode *inode = old_dentry->
d_inode;
201 inode_inc_link_count(inode);
204 err = nilfs_add_nondir(dentry, inode);
213 static int nilfs_mkdir(
struct inode *dir,
struct dentry *dentry,
umode_t mode)
226 err = PTR_ERR(inode);
265 static int nilfs_do_unlink(
struct inode *dir,
struct dentry *dentry)
284 "deleting nonexistent file (%lu), %d\n",
299 static int nilfs_unlink(
struct inode *dir,
struct dentry *dentry)
308 err = nilfs_do_unlink(dir, dentry);
320 static int nilfs_rmdir(
struct inode *dir,
struct dentry *dentry)
322 struct inode *inode = dentry->
d_inode;
332 err = nilfs_do_unlink(dir, dentry);
349 static int nilfs_rename(
struct inode *old_dir,
struct dentry *old_dentry,
350 struct inode *new_dir,
struct dentry *new_dentry)
352 struct inode *old_inode = old_dentry->
d_inode;
354 struct page *dir_page =
NULL;
356 struct page *old_page;
378 struct page *new_page;
440 static struct dentry *nilfs_get_parent(
struct dentry *
child)
451 root = NILFS_I(child->
d_inode)->i_root;
455 return ERR_CAST(inode);
477 return ERR_CAST(inode);
485 static struct dentry *nilfs_fh_to_dentry(
struct super_block *sb,
struct fid *fh,
486 int fh_len,
int fh_type)
496 return nilfs_get_dentry(sb, fid->
cno, fid->
ino, fid->
gen);
499 static struct dentry *nilfs_fh_to_parent(
struct super_block *sb,
struct fid *fh,
500 int fh_len,
int fh_type)
511 static int nilfs_encode_fh(
struct inode *inode,
__u32 *fh,
int *lenp,
512 struct inode *parent)
515 struct nilfs_root *root = NILFS_I(inode)->i_root;
545 .create = nilfs_create,
546 .lookup = nilfs_lookup,
548 .unlink = nilfs_unlink,
549 .symlink = nilfs_symlink,
550 .mkdir = nilfs_mkdir,
551 .rmdir = nilfs_rmdir,
552 .mknod = nilfs_mknod,
553 .rename = nilfs_rename,
572 .encode_fh = nilfs_encode_fh,
573 .fh_to_dentry = nilfs_fh_to_dentry,
574 .fh_to_parent = nilfs_fh_to_parent,
575 .get_parent = nilfs_get_parent,