All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: hooanon05g@gmail.com
Cc: linux-fsdevel@vger.kernel.org, adilger@dilger.ca, hch@lst.de,
	dchinner@redhat.com, viro@zeniv.linux.org.uk, jlbec@evilplan.org,
	gregkh@linuxfoundation.org, hughd@google.com
Subject: Re: [RFC 2/3] vfs: get_next_ino(), support for the uniqueness
Date: Thu, 22 May 2014 13:56:57 +0200	[thread overview]
Message-ID: <20140522115657.GD7999@quack.suse.cz> (raw)
In-Reply-To: <1400698140-25853-3-git-send-email-hooanon05g@gmail.com>

On Thu 22-05-14 03:48:59, hooanon05g@gmail.com wrote:
> From: "J. R. Okajima" <hooanon05g@gmail.com>
> 
> Add a feature to keep the uniqueness of inum in the superblock.
> In this commit, the parameter superblock sets NULL, so the feature is
> OFF. It will be ON individually be thier maintainer.
> 
> Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
...
> diff --git a/fs/inode.c b/fs/inode.c
> index a3e274a..1412607 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -834,8 +834,9 @@ repeat:
>  #define LAST_INO_BATCH 1024
>  static DEFINE_PER_CPU(unsigned int, last_ino);
>  
> -unsigned int get_next_ino(void)
> +static unsigned int do_get_next_ino(struct super_block *sb, int *pwrapped)
>  {
> +	static int wrapped;
>  	unsigned int *p = &get_cpu_var(last_ino);
>  	unsigned int res = *p;
>  
> @@ -850,10 +851,60 @@ unsigned int get_next_ino(void)
>  
>  	res++;
>  	/* never zero */
> -	if (unlikely(!res))
> +	if (unlikely(!res)) {
>  		res++;
> +		wrapped = 1;
> +	}
>  	*p = res;
>  	put_cpu_var(last_ino);
> +	*pwrapped = wrapped;
> +	return res;
> +}
> +
> +static int test_ino_sb(struct super_block *sb, unsigned long ino)
> +{
> +	int in_use;
> +	struct inode *inode, *next;
> +
> +	in_use = 0;
> +	spin_lock(&inode_sb_list_lock);
> +	list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
> +		if (inode->i_ino != ino)
> +			continue;
> +		in_use = 1;
> +		break;
> +	}
> +	spin_unlock(&inode_sb_list_lock);
> +
> +	return in_use;
> +}
  I don't think scanning the whole superblock list is really a viable
alternative. That is going to contend a lot on inode_sb_list_lock and burn
a lot of CPU when there is even moderate number of inodes in tmpfs. If we
ever have to really use unique inode numbers for tmpfs (but I'm not
convinced - see my other email), we should probably hash those inodes and
use iunique()...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2014-05-22 11:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 18:48 [RFC 0/3] vfs: get_next_ino(), never inum=0 and uniqueness hooanon05g
2014-05-21 18:48 ` [RFC 1/3] vfs: get_next_ino(), never inum=0 hooanon05g
2014-05-28  4:28   ` Hugh Dickins
2014-05-28  5:53     ` Eric Dumazet
2014-05-21 18:48 ` [RFC 2/3] vfs: get_next_ino(), support for the uniqueness hooanon05g
2014-05-22 11:56   ` Jan Kara [this message]
2014-05-22 15:03     ` J. R. Okajima
2014-05-22 15:12       ` Jan Kara
2014-05-22 15:14         ` Christoph Hellwig
2014-05-22 16:06           ` Jan Kara
2014-05-29 15:46           ` [PATCH v2 1/2] tmpfs: manage the inode-number by IDR J. R. Okajima
2014-05-29 15:46             ` [PATCH v2 2/2] tmpfs: refine a file handle for NFS-exporting J. R. Okajima
2014-05-31  2:43             ` [PATCH v2 1/2] tmpfs: manage the inode-number by IDR J. R. Okajima
2014-06-01 16:18           ` [RFC PATCH v3 0/2] the uniquness of tmpfs inode-number J. R. Okajima
2014-06-01 16:18             ` [RFC PATCH v3 1/2] tmpfs: manage the inode-number by IDR, signed int inum J. R. Okajima
2014-06-03  9:04               ` Jan Kara
2014-06-03 14:36                 ` J. R. Okajima
2014-06-05 12:27                 ` [RFC PATCH v4 0/2] tmpfs: manage the inode-number by IDR (performance measure) J. R. Okajima
2014-06-05 12:27                   ` [RFC PATCH v4 1/2] tmpfs: manage the inode-number by IDR, signed int inum J. R. Okajima
2014-06-05 12:27                   ` [RFC PATCH v4 2/2] tmpfs: refine a file handle for NFS-exporting J. R. Okajima
2014-06-01 16:18             ` [RFC PATCH v3 " J. R. Okajima
2014-05-21 18:49 ` [RFC 3/3] uniqueness of inode number, configfs, debugfs, procfs, ramfs and tmpfs hooanon05g
2014-05-22  1:03   ` J. R. Okajima
2014-05-22 11:53     ` Jan Kara
2014-05-22 14:58       ` J. R. Okajima
2014-05-22 15:09         ` Jan Kara

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=20140522115657.GD7999@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger@dilger.ca \
    --cc=dchinner@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=hooanon05g@gmail.com \
    --cc=hughd@google.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.