Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756660Ab2JWHBw (ORCPT ); Tue, 23 Oct 2012 03:01:52 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:47463 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752390Ab2JWHBv (ORCPT ); Tue, 23 Oct 2012 03:01:51 -0400 MIME-Version: 1.0 In-Reply-To: <001b01cdb0c6$67e386b0$37aa9410$%kim@samsung.com> References: <001001cdb0c5$2ac96520$805c2f60$%kim@samsung.com> <001b01cdb0c6$67e386b0$37aa9410$%kim@samsung.com> Date: Tue, 23 Oct 2012 09:01:48 +0200 Message-ID: Subject: Re: [PATCH 11/16 v2] f2fs: add inode operations for special inodes From: Marco Stornelli 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 Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2827 Lines: 96 2012/10/23 Jaegeuk Kim : > This adds inode operations for directory, symlink, and special inodes. > > Signed-off-by: Changman Lee > Signed-off-by: Jaegeuk Kim > --- > 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 > +#include > +#include > +#include > +#include > + > +#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? Marco -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/