From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: 'Marco Stornelli' <marco.stornelli@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk,
arnd@arndb.de, tytso@mit.edu, chur.lee@samsung.com,
cm224.lee@samsung.com, jooyoung.hwang@samsung.com
Subject: RE: [PATCH 11/16 v2] f2fs: add inode operations for special inodes
Date: Tue, 23 Oct 2012 17:49:03 +0900 [thread overview]
Message-ID: <00a201cdb0fb$412efa10$c38cee30$%kim@samsung.com> (raw)
In-Reply-To: <CANGUGtBtgmWW1VjMP5mEK9qOzLxLUSgD_KvUr1b0+Yi3bHgVBQ@mail.gmail.com>
> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@samsung.com>:
> >
> >> -----Original Message-----
> >> From: Marco Stornelli [mailto:marco.stornelli@gmail.com]
> >> Sent: Tuesday, October 23, 2012 4:02 PM
> >> To: Jaegeuk Kim
> >> Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org; gregkh@linuxfoundation.org;
> >> viro@zeniv.linux.org.uk; arnd@arndb.de; tytso@mit.edu; chur.lee@samsung.com; cm224.lee@samsung.com;
> >> jooyoung.hwang@samsung.com
> >> Subject: Re: [PATCH 11/16 v2] f2fs: add inode operations for special inodes
> >> Importance: High
> >>
> >> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@samsung.com>:
> >> > This adds inode operations for directory, symlink, and special inodes.
> >> >
> >> > Signed-off-by: Changman Lee <cm224.lee@samsung.com>
> >> > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> >> > ---
> >> > 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
next prev parent reply other threads:[~2012-10-23 8:49 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 2:21 [PATCH 00/16 v2] f2fs: introduce flash-friendly file system Jaegeuk Kim
2012-10-23 2:25 ` [PATCH 01/16 v2] f2fs: add document Jaegeuk Kim
2012-10-23 11:41 ` Vyacheslav Dubeyko
2012-10-25 22:14 ` Jaegeuk Kim
2012-10-23 2:26 ` [PATCH 02/16 v2] f2fs: add on-disk layout Jaegeuk Kim
2012-10-23 3:46 ` NeilBrown
2012-10-23 6:30 ` Jaegeuk Kim
2012-10-23 6:47 ` Marco Stornelli
2012-10-23 7:08 ` Jaegeuk Kim
2012-10-24 11:25 ` Vyacheslav Dubeyko
2012-10-26 3:31 ` Jaegeuk Kim
2012-10-26 8:18 ` Arnd Bergmann
2012-10-26 8:31 ` Jaegeuk Kim
2012-10-26 12:48 ` Vyacheslav Dubeyko
2012-10-26 13:13 ` Jaegeuk Kim
2012-10-26 13:13 ` Jaegeuk Kim
2012-10-23 2:26 ` [PATCH 03/16 v2] f2fs: add superblock and major in-memory structure Jaegeuk Kim
2012-10-27 13:58 ` Vyacheslav Dubeyko
2012-10-23 2:27 ` [PATCH 04/16 v2] f2fs: add super block operations Jaegeuk Kim
2012-10-23 6:51 ` Marco Stornelli
2012-10-23 7:09 ` Jaegeuk Kim
2012-10-28 12:08 ` Vyacheslav Dubeyko
2012-10-23 2:28 ` [PATCH 05/16 v2] f2fs: add checkpoint operations Jaegeuk Kim
2012-10-23 2:28 ` [PATCH 06/16 v2] f2fs: add node operations Jaegeuk Kim
2012-10-23 2:28 ` [PATCH 07/16 v2] f2fs: add segment operations Jaegeuk Kim
2012-10-23 3:02 ` Max Filippov
2012-10-23 3:23 ` Jaegeuk Kim
2012-10-23 2:29 ` [PATCH 08/16 v2] f2fs: add file operations Jaegeuk Kim
2012-10-23 6:58 ` Marco Stornelli
2012-10-23 7:31 ` Jaegeuk Kim
2012-10-23 7:39 ` Marco Stornelli
2012-10-23 2:29 ` [PATCH 09/16 v2] f2fs: add address space operations for data Jaegeuk Kim
2012-10-23 2:30 ` [PATCH 10/16 v2] f2fs: add core inode operations Jaegeuk Kim
2012-10-23 2:30 ` [PATCH 11/16 v2] f2fs: add inode operations for special inodes Jaegeuk Kim
2012-10-23 7:01 ` Marco Stornelli
2012-10-23 7:46 ` Jaegeuk Kim
2012-10-23 8:20 ` Marco Stornelli
2012-10-23 8:49 ` Jaegeuk Kim [this message]
2012-10-23 9:35 ` Marco Stornelli
2012-10-23 2:31 ` [PATCH 12/16 v2] f2fs: add core directory operations Jaegeuk Kim
2012-10-23 2:31 ` [PATCH 13/16 v2] f2fs: add xattr and acl functionalities Jaegeuk Kim
2012-10-23 2:32 ` [PATCH 14/16 v2] f2fs: add garbage collection functions Jaegeuk Kim
2012-10-23 2:32 ` [PATCH 15/16 v2] f2fs: add recovery routines for roll-forward Jaegeuk Kim
2012-10-23 2:33 ` [PATCH 16/16 v2] f2fs: update Kconfig and Makefile Jaegeuk Kim
2012-10-23 3:04 ` Greg KH
2012-10-23 3:21 ` Jaegeuk Kim
2012-10-23 18:20 ` [PATCH 0/3] f2fs: move proc files to debugfs Greg KH
2012-10-23 18:21 ` [PATCH 1/3] f2fs: gc.h: make should_do_checkpoint() inline Greg KH
2012-10-23 18:22 ` [PATCH 2/3] f2fs: move statistics code into one file Greg KH
2012-10-23 18:23 ` [PATCH 3/3] f2fs: move proc files to debugfs Greg KH
2012-10-23 19:20 ` [PATCH 3/3 v2] " Greg KH
2012-10-23 19:11 ` [PATCH 0/3] " Greg KH
2012-10-25 8:12 ` Jaegeuk Kim
2012-10-23 18:26 ` [PATCH 00/16 v2] f2fs: introduce flash-friendly file system Greg KH
2012-10-23 18:57 ` Greg KH
2012-10-23 23:18 ` Jaegeuk Kim
2012-10-24 3:02 ` 'Greg KH'
2012-10-24 5:35 ` Jaegeuk Kim
2012-10-23 23:14 ` Jaegeuk Kim
2012-10-24 3:01 ` 'Greg KH'
2012-10-24 5:34 ` Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00a201cdb0fb$412efa10$c38cee30$%kim@samsung.com' \
--to=jaegeuk.kim@samsung.com \
--cc=arnd@arndb.de \
--cc=chur.lee@samsung.com \
--cc=cm224.lee@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jooyoung.hwang@samsung.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.stornelli@gmail.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.