linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: 'Jaegeuk Kim' <jaegeuk@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 02/11] f2fs: punch the core function for inode	management
Date: Tue, 29 Jul 2014 19:29:24 +0800	[thread overview]
Message-ID: <007e01cfab20$7319fd60$594df820$@samsung.com> (raw)
In-Reply-To: <1406328445-63707-2-git-send-email-jaegeuk@kernel.org>

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Saturday, July 26, 2014 6:47 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 02/11] f2fs: punch the core function for inode management
> 
> This patch punches out the core functions to manage the inode numbers.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>

> ---
>  fs/f2fs/checkpoint.c | 81 ++++++++++++++++++++++++++++------------------------
>  1 file changed, 44 insertions(+), 37 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 0b4710c..3e3c2c3 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -282,6 +282,47 @@ const struct address_space_operations f2fs_meta_aops = {
>  	.set_page_dirty	= f2fs_set_meta_page_dirty,
>  };
> 
> +static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino)
> +{
> +	struct list_head *head;
> +	struct ino_entry *new, *e;
> +
> +	new = f2fs_kmem_cache_alloc(orphan_entry_slab, GFP_ATOMIC);
> +	new->ino = ino;
> +
> +	spin_lock(&sbi->orphan_inode_lock);
> +	list_for_each_entry(e, &sbi->orphan_inode_list, list) {
> +		if (e->ino == ino) {
> +			spin_unlock(&sbi->orphan_inode_lock);
> +			kmem_cache_free(orphan_entry_slab, new);
> +			return;
> +		}
> +		if (e->ino > ino)
> +			break;
> +	}
> +
> +	/* add new entry into list which is sorted by inode number */
> +	list_add_tail(&new->list, &e->list);
> +	spin_unlock(&sbi->orphan_inode_lock);
> +}
> +
> +static void __remove_ino_entry(struct f2fs_sb_info *sbi, nid_t ino)
> +{
> +	struct ino_entry *e;
> +
> +	spin_lock(&sbi->orphan_inode_lock);
> +	list_for_each_entry(e, &sbi->orphan_inode_list, list) {
> +		if (e->ino == ino) {
> +			list_del(&e->list);
> +			sbi->n_orphans--;
> +			spin_unlock(&sbi->orphan_inode_lock);
> +			kmem_cache_free(orphan_entry_slab, e);
> +			return;
> +		}
> +	}
> +	spin_unlock(&sbi->orphan_inode_lock);
> +}
> +
>  int acquire_orphan_inode(struct f2fs_sb_info *sbi)
>  {
>  	int err = 0;
> @@ -306,48 +347,14 @@ void release_orphan_inode(struct f2fs_sb_info *sbi)
> 
>  void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  {
> -	struct list_head *head;
> -	struct orphan_inode_entry *new, *orphan;
> -
> -	new = f2fs_kmem_cache_alloc(orphan_entry_slab, GFP_ATOMIC);
> -	new->ino = ino;
> -
> -	spin_lock(&sbi->orphan_inode_lock);
> -	head = &sbi->orphan_inode_list;
> -	list_for_each_entry(orphan, head, list) {
> -		if (orphan->ino == ino) {
> -			spin_unlock(&sbi->orphan_inode_lock);
> -			kmem_cache_free(orphan_entry_slab, new);
> -			return;
> -		}
> -
> -		if (orphan->ino > ino)
> -			break;
> -	}
> -
>  	/* add new orphan entry into list which is sorted by inode number */
> -	list_add_tail(&new->list, &orphan->list);
> -	spin_unlock(&sbi->orphan_inode_lock);
> +	__add_ino_entry(sbi, ino);
>  }
> 
>  void remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  {
> -	struct list_head *head;
> -	struct orphan_inode_entry *orphan;
> -
> -	spin_lock(&sbi->orphan_inode_lock);
> -	head = &sbi->orphan_inode_list;
> -	list_for_each_entry(orphan, head, list) {
> -		if (orphan->ino == ino) {
> -			list_del(&orphan->list);
> -			f2fs_bug_on(sbi->n_orphans == 0);
> -			sbi->n_orphans--;
> -			spin_unlock(&sbi->orphan_inode_lock);
> -			kmem_cache_free(orphan_entry_slab, orphan);
> -			return;
> -		}
> -	}
> -	spin_unlock(&sbi->orphan_inode_lock);
> +	/* remove orphan entry from orphan list */
> +	__remove_ino_entry(sbi, ino);
>  }
> 
>  static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
> --
> 1.8.5.2 (Apple Git-48)
> 
> 
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk

  reply	other threads:[~2014-07-29 11:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 22:47 [PATCH 01/11] f2fs: add nobarrier mount option Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 02/11] f2fs: punch the core function for inode management Jaegeuk Kim
2014-07-29 11:29   ` Chao Yu [this message]
2014-07-25 22:47 ` [PATCH 03/11] f2fs: add infra for ino management Jaegeuk Kim
2014-07-29 11:30   ` Chao Yu
2014-07-25 22:47 ` [PATCH 04/11] f2fs: use radix_tree " Jaegeuk Kim
2014-07-29 11:32   ` Chao Yu
2014-07-29 12:34     ` Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 05/11] f2fs: add info of appended or updated data writes Jaegeuk Kim
2014-07-29 11:38   ` Chao Yu
2014-07-25 22:47 ` [PATCH 06/11] f2fs: skip unnecessary data writes during fsync Jaegeuk Kim
2014-07-29 11:39   ` Chao Yu
2014-07-29 12:43     ` Jaegeuk Kim
2014-07-30 11:58       ` Chao Yu
2014-07-25 22:47 ` [PATCH 07/11] f2fs: enable in-place-update for fdatasync Jaegeuk Kim
2014-07-29  0:41   ` Changman Lee
2014-07-29 12:22     ` [f2fs-dev] " Jaegeuk Kim
2014-07-29 23:54       ` Changman Lee
2014-07-30  1:08         ` Jaegeuk Kim
2014-07-30  1:56           ` [f2fs-dev] " Changman Lee
2014-07-30  3:11             ` Jaegeuk Kim
2014-07-30  2:45           ` [f2fs-dev] " Chao Yu
2014-07-30  3:13             ` Jaegeuk Kim
2014-07-30 12:48               ` [f2fs-dev] " Chao Yu
2014-07-25 22:47 ` [PATCH 08/11] f2fs: fix wrong condition for unlikely Jaegeuk Kim
2014-07-30  1:44   ` Chao Yu
2014-07-30  3:18     ` Jaegeuk Kim
2014-07-30 12:58       ` Chao Yu
2014-07-25 22:47 ` [PATCH 09/11] f2fs: test before set/clear bits Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 10/11] f2fs: avoid checkpoint when error was occurred Jaegeuk Kim
2014-07-29 11:41   ` Chao Yu
2014-07-29 13:00     ` Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 11/11] f2fs: avoid retrying wrong recovery routine " Jaegeuk Kim
2014-07-29 13:01   ` [PATCH v2 " Jaegeuk Kim
2014-07-29 11:28 ` [PATCH 01/11] f2fs: add nobarrier mount option Chao Yu
2014-07-29 12:22   ` 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='007e01cfab20$7319fd60$594df820$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).