public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: 김재극 <jaegeuk.kim@samsung.com>
Cc: viro@zeniv.linux.org.uk, "'Theodore Ts'o'" <tytso@mit.edu>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	chur.lee@samsung.com, cm224.lee@samsung.com,
	jooyoung.hwang@samsung.com
Subject: Re: [PATCH 10/16] f2fs: add core inode operations
Date: Fri, 05 Oct 2012 13:28:04 -0700	[thread overview]
Message-ID: <87mx00slyj.fsf@xmission.com> (raw)
In-Reply-To: <001101cda2f1$50a23c40$f1e6b4c0$%kim@samsung.com> ("김재극"'s message of "Fri, 05 Oct 2012 21:02:38 +0900")

김재극 <jaegeuk.kim@samsung.com> writes:

> This adds core functions to get, read, write, and evict an inode.

As is this code won't compile if user namespace support is enabled.
Suggested fixes below.

Eric


> +static int do_read_inode(struct inode *inode)
> +{
> +	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
> +	struct f2fs_inode_info *fi = F2FS_I(inode);
> +	struct page *node_page;
> +	struct f2fs_node *rn;
> +	struct f2fs_inode *ri;
> +
> +	/* Check if ino is within scope */
> +	check_nid_range(sbi, inode->i_ino);
> +
> +	node_page = get_node_page(sbi, inode->i_ino);
> +	if (IS_ERR(node_page))
> +		return PTR_ERR(node_page);
> +
> +	rn = page_address(node_page);
> +	ri = &(rn->i);
> +
> +	inode->i_mode = le16_to_cpu(ri->i_mode);
> +	inode->i_uid = le32_to_cpu(ri->i_uid);
> +	inode->i_gid = le32_to_cpu(ri->i_gid);

Could you make this:
	i_uid_write(inode, le32_to_cpu(ri->i_uid));
	i_gid_write(inode, le32_to_cpu(ri->i_gid));

> +	set_nlink(inode, le32_to_cpu(ri->i_links));
> +	inode->i_size = le64_to_cpu(ri->i_size);
> +	inode->i_blocks = le64_to_cpu(ri->i_blocks);
> +
> +	inode->i_atime.tv_sec = le32_to_cpu(ri->i_atime);
> +	inode->i_ctime.tv_sec = le32_to_cpu(ri->i_ctime);
> +	inode->i_mtime.tv_sec = le32_to_cpu(ri->i_mtime);
> +	inode->i_atime.tv_nsec = 0;
> +	inode->i_ctime.tv_nsec = 0;
> +	inode->i_mtime.tv_nsec = 0;
> +	fi->current_depth = le32_to_cpu(ri->current_depth);
> +	fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid);
> +	fi->i_flags = le32_to_cpu(ri->i_flags);
> +	fi->flags = 0;
> +	fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1;
> +	get_extent_info(&fi->ext, ri->i_ext);
> +	f2fs_put_page(node_page, 1);
> +	return 0;
> +}

> +void update_inode(struct inode *inode, struct page *node_page)
> +{
> +	struct f2fs_node *rn;
> +	struct f2fs_inode *ri;
> +
> +	wait_on_page_writeback(node_page);
> +
> +	rn = page_address(node_page);
> +	ri = &(rn->i);
> +
> +	ri->i_mode = cpu_to_le16(inode->i_mode);
> +	ri->i_uid = cpu_to_le32(inode->i_uid);
> +	ri->i_gid = cpu_to_le32(inode->i_gid);
And make this:
	i_uid_write(inode, le32_to_cpu(ri->i_uid));
	i_gid_write(inode, le32_to_cpu(ri->i_gid));

> +	ri->i_links = cpu_to_le32(inode->i_nlink);
> +	ri->i_size = cpu_to_le64(i_size_read(inode));
> +	ri->i_blocks = cpu_to_le64(inode->i_blocks);
> +	set_raw_extent(&F2FS_I(inode)->ext, &ri->i_ext);
> +
> +	ri->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
> +	ri->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
> +	ri->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
> +	ri->current_depth = cpu_to_le32(F2FS_I(inode)->current_depth);
> +	ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid);
> +	ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags);
> +	set_page_dirty(node_page);
> +}

  reply	other threads:[~2012-10-05 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 12:02 [PATCH 10/16] f2fs: add core inode operations 김재극
2012-10-05 20:28 ` Eric W. Biederman [this message]
2012-10-06 18:06   ` Jaegeuk Kim
     [not found]   ` <CAN863Pu_W4P74oQyJQnkXhUW+q-0zJR7F+gW_n6JqoOQOwG0ww@mail.gmail.com>
2012-10-08 16:35     ` Eric W. Biederman

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=87mx00slyj.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=chur.lee@samsung.com \
    --cc=cm224.lee@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaegeuk.kim@samsung.com \
    --cc=jooyoung.hwang@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox