From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: Huajun Li <huajun.li.lee@gmail.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Huajun Li <huajun.li@intel.com>,
Haicheng Li <haicheng.li@linux.intel.com>,
Weihong Xu <weihong.xu@intel.com>
Subject: Re: [f2fs-dev][PATCH V2 4/6] f2fs: Key functions to handle inline data
Date: Fri, 15 Nov 2013 16:49:09 +0900 [thread overview]
Message-ID: <1384501749.14041.107.camel@kjgkr> (raw)
In-Reply-To: <1384096401-25169-5-git-send-email-huajun.li.lee@gmail.com>
Hi Huajun,
[snip]
> +static int __f2fs_convert_inline_data(struct inode *inode, struct page *page)
> +{
> + int err;
> + struct page *ipage;
> + struct dnode_of_data dn;
> + void *src_addr, *dst_addr;
> + block_t old_blk_addr, new_blk_addr;
> + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
> +
> + f2fs_lock_op(sbi);
> + ipage = get_node_page(sbi, inode->i_ino);
> + if (IS_ERR(ipage))
> + return PTR_ERR(ipage);
> +
> + /*
> + * i_addr[0] is not used for inline data,
> + * so reserving new block will not destroy inline data
> + */
> + set_new_dnode(&dn, inode, ipage, ipage, 0);
> + err = f2fs_reserve_block(&dn, 0);
> + if (err) {
> + f2fs_put_page(ipage, 1);
> + f2fs_unlock_op(sbi);
> + return err;
> + }
> +
> + src_addr = inline_data_addr(ipage);
> + dst_addr = page_address(page);
> + zero_user_segment(page, 0, PAGE_CACHE_SIZE);
> +
> + /* Copy the whole inline data block */
> + memcpy(dst_addr, src_addr, MAX_INLINE_DATA);
> +
> + /* write data page to try to make data consistent */
> + old_blk_addr = dn.data_blkaddr;
> + set_page_writeback(page);
> + write_data_page(inode, page, &dn,
> + old_blk_addr, &new_blk_addr);
> + update_extent_cache(new_blk_addr, &dn);
> + f2fs_wait_on_page_writeback(page, DATA, true);
> +
> + /* clear inline data and flag after data writeback */
> + zero_user_segment(ipage, INLINE_DATA_OFFSET,
> + INLINE_DATA_OFFSET + MAX_INLINE_DATA);
> + clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA);
> +
> + sync_inode_page(&dn);
> + f2fs_put_page(ipage, 1);
Again, it seems that you missed what I mentioned.
If we write the inlined data block only, we cannot recover the data
block after SPO.
In order to avoid that, we should write its dnode block too by
triggering sync_node_pages(ino) at this point as similar as fsync
routine.
Thanks,
--
Jaegeuk Kim
Samsung
next prev parent reply other threads:[~2013-11-15 7:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-10 15:13 [f2fs-dev][PATCH V2 0/6] f2fs: Enable f2fs support inline data Huajun Li
2013-11-10 15:13 ` [PATCH V2 1/6] f2fs: Add flags and helpers to " Huajun Li
2013-11-10 15:13 ` [PATCH V2 2/6] f2fs: Add a new mount option: inline_data Huajun Li
2013-11-10 15:13 ` [PATCH V2 3/6] f2fs: Add a new function: f2fs_reserve_block() Huajun Li
2013-11-25 11:05 ` [f2fs-dev][PATCH " Jaegeuk Kim
2013-11-10 15:13 ` [f2fs-dev][PATCH V2 4/6] f2fs: Key functions to handle inline data Huajun Li
2013-11-15 7:49 ` Jaegeuk Kim [this message]
2013-11-20 12:51 ` [PATCH " Huajun Li
2013-11-25 11:01 ` [f2fs-dev][PATCH " Jaegeuk Kim
2013-11-10 15:13 ` [PATCH V2 5/6] f2fs: Handle inline data operations Huajun Li
2013-11-10 15:13 ` [PATCH V2 6/6] f2fs: update f2fs Documentation Huajun Li
2013-11-26 7:45 ` [PATCH V2 0/6] f2fs: Enable f2fs support inline data 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=1384501749.14041.107.camel@kjgkr \
--to=jaegeuk.kim@samsung.com \
--cc=haicheng.li@linux.intel.com \
--cc=huajun.li.lee@gmail.com \
--cc=huajun.li@intel.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=weihong.xu@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).