RE: [PATCH 11/16 v2] f2fs: add inode operations for special inodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>:
> >
> >> -----Original Message-----
> >> From: Marco Stornelli [mailto:marco.stornelli@xxxxxxxxx]
> >> Sent: Tuesday, October 23, 2012 4:02 PM
> >> To: Jaegeuk Kim
> >> Cc: linux-fsdevel@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx;
> >> viro@xxxxxxxxxxxxxxxxxx; arnd@xxxxxxxx; tytso@xxxxxxx; chur.lee@xxxxxxxxxxx; cm224.lee@xxxxxxxxxxx;
> >> jooyoung.hwang@xxxxxxxxxxx
> >> Subject: Re: [PATCH 11/16 v2] f2fs: add inode operations for special inodes
> >> Importance: High
> >>
> >> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>:
> >> > This adds inode operations for directory, symlink, and special inodes.
> >> >
> >> > Signed-off-by: Changman Lee <cm224.lee@xxxxxxxxxxx>
> >> > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@xxxxxxxxxxx>
> >> > ---
> >> >  fs/f2fs/namei.c |  494 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >  1 file changed, 494 insertions(+)
> >> >  create mode 100644 fs/f2fs/namei.c
> >> >
> >> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> >> > new file mode 100644
> >> > index 0000000..899d144
> >> > --- /dev/null
> >> > +++ b/fs/f2fs/namei.c
> >> > @@ -0,0 +1,494 @@
> >> > +/**
> >> > + * fs/f2fs/namei.c
> >> > + *
> >> > + * Copyright (c) 2012 Samsung Electronics Co., Ltd.
> >> > + *             http://www.samsung.com/
> >> > + *
> >> > + * This program is free software; you can redistribute it and/or modify
> >> > + * it under the terms of the GNU General Public License version 2 as
> >> > + * published by the Free Software Foundation.
> >> > + */
> >> > +#include <linux/fs.h>
> >> > +#include <linux/f2fs_fs.h>
> >> > +#include <linux/pagemap.h>
> >> > +#include <linux/sched.h>
> >> > +#include <linux/ctype.h>
> >> > +
> >> > +#include "f2fs.h"
> >> > +#include "xattr.h"
> >> > +#include "acl.h"
> >> > +
> >> > +static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
> >> > +{
> >> > +       struct super_block *sb = dir->i_sb;
> >> > +       struct f2fs_sb_info *sbi = F2FS_SB(sb);
> >> > +       nid_t ino;
> >> > +       struct inode *inode;
> >> > +       bool nid_free = false;
> >> > +       int err;
> >> > +
> >> > +       inode = new_inode(sb);
> >> > +       if (!inode)
> >> > +               return ERR_PTR(-ENOMEM);
> >> > +
> >> > +       mutex_lock_op(sbi, NODE_NEW);
> >> > +       if (!alloc_nid(sbi, &ino)) {
> >> > +               mutex_unlock_op(sbi, NODE_NEW);
> >> > +               err = -ENOSPC;
> >> > +               goto fail;
> >> > +       }
> >> > +       mutex_unlock_op(sbi, NODE_NEW);
> >> > +
> >> > +       inode->i_uid = current_fsuid();
> >> > +
> >> > +       if (dir->i_mode & S_ISGID) {
> >> > +               inode->i_gid = dir->i_gid;
> >> > +               if (S_ISDIR(mode))
> >> > +                       mode |= S_ISGID;
> >> > +       } else {
> >> > +               inode->i_gid = current_fsgid();
> >> > +       }
> >> > +
> >> > +       inode->i_ino = ino;
> >> > +       inode->i_mode = mode;
> >> > +       inode->i_blocks = 0;
> >> > +       inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
> >> > +
> >> > +       err = insert_inode_locked(inode);
> >> > +       if (err) {
> >> > +               err = -EINVAL;
> >> > +               nid_free = true;
> >> > +               goto out;
> >> > +       }
> >> > +
> >> > +       mark_inode_dirty(inode);
> >> > +       return inode;
> >> > +
> >> > +out:
> >> > +       clear_nlink(inode);
> >> > +       unlock_new_inode(inode);
> >> > +fail:
> >> > +       iput(inode);
> >>
> >> make_bad_inode here?
> >
> > I wanted to call f2fs_evict_inode() at this moment.
> > - f2fs_evict_inode()
> >  - remove_inode_page()
> >    -> check any erroneous conditions.
> >
> > Got coffee? :)
> >
> 
> Not yet, I'm reading my 240 email yet :)
> I meant not to replace iput but to add make_bad_inode() before (I
> don't know if it was clear). I don't know if it's the right thing to
> do. In case of "out" I'd do the "rollback" here.
> 

Sorry, I confused what you said. I need a cup of coffee.
IMHO, it seems there is no difference, since f2fs doesn't allow
a race condition on inodes with a same inode number.
(e.g., one is bad, and the other is newly allocated with the same
inode number.)

> Marco

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux