[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANGUGtD-X9suBdnx7jGkAcJNauVrYWWtz4ncR84i6RursTNCYA@mail.gmail.com>
Date: Tue, 23 Oct 2012 11:35:12 +0200
From: Marco Stornelli <marco.stornelli@...il.com>
To: Jaegeuk Kim <jaegeuk.kim@...sung.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org, viro@...iv.linux.org.uk, arnd@...db.de,
tytso@....edu, chur.lee@...sung.com, cm224.lee@...sung.com,
jooyoung.hwang@...sung.com
Subject: Re: [PATCH 11/16 v2] f2fs: add inode operations for special inodes
2012/10/23 Jaegeuk Kim <jaegeuk.kim@...sung.com>:
>> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@...sung.com>:
>> >
>> >> -----Original Message-----
>> >> From: Marco Stornelli [mailto:marco.stornelli@...il.com]
>> >> Sent: Tuesday, October 23, 2012 4:02 PM
>> >> To: Jaegeuk Kim
>> >> Cc: linux-fsdevel@...r.kernel.org; linux-kernel@...r.kernel.org; gregkh@...uxfoundation.org;
>> >> viro@...iv.linux.org.uk; arnd@...db.de; tytso@....edu; chur.lee@...sung.com; cm224.lee@...sung.com;
>> >> jooyoung.hwang@...sung.com
>> >> Subject: Re: [PATCH 11/16 v2] f2fs: add inode operations for special inodes
>> >> Importance: High
>> >>
>> >> 2012/10/23 Jaegeuk Kim <jaegeuk.kim@...sung.com>:
>> >> > This adds inode operations for directory, symlink, and special inodes.
>> >> >
>> >> > Signed-off-by: Changman Lee <cm224.lee@...sung.com>
>> >> > Signed-off-by: Jaegeuk Kim <jaegeuk.kim@...sung.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
>
It was only a suggestion :)
Marco
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists