All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
To: Bernd Schubert
	<bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
Cc: "J. Bruce Fields"
	<bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Bernd Schubert
	<bernd.schubert-97jfqw80gc6171pxa8y+qA@public.gmane.org>,
	Ted Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	yong.fan-KloliPT79xf2eFz/2MeuCQ@public.gmane.org,
	sandeen-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	adilger-KloliPT79xf2eFz/2MeuCQ@public.gmane.org
Subject: Re: [PATCH 5 3/4] nfsd_open(): rename 'int access' to 'int may_flags' in nfsd_open()
Date: Thu, 12 Apr 2012 16:49:48 -0400	[thread overview]
Message-ID: <20120412204948.GE6667@fieldses.org> (raw)
In-Reply-To: <4F60AC0D.9020204-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>

On Wed, Mar 14, 2012 at 03:32:45PM +0100, Bernd Schubert wrote:
> On 03/13/2012 10:29 PM, J. Bruce Fields wrote:
> > On Tue, Mar 13, 2012 at 10:09:05PM +0100, Bernd Schubert wrote:
> >> Hmm, there must have gone something wrong on merging,
> >
> > In that case one approach would be to rebase your last-sent patches on
> > to the same base as Ted's versions, confirm that one still works and the
> > other doesn't, and do a diff....
> >
> >> my own test
> >> also fails
> >>
> >> http://www.pci.uni-heidelberg.de/tc/usr/bernd/downloads/test_seekdir/
> >>
> >> (Sorry, it does not say 'failure', but one needs to compare the file
> >> names and telldir-offset numbers)
> >>
> >> I think I will continue in the morning as its already 1 a.m. here.
> >
> > OK, thanks for following up!

Stupid question: is there any fundamental feature of ext4 this depends
on, or would this fix work equally well for fs/ext3?

--b.

> 
> Took me some time to figure out what is going on and in the end I previously forgot 
> another test case - I always tested directories being sufficiently large, so that 
> they got the EXT4_INODE_INDEX flag. However, the cython tests failed on a small 
> directory, which doesn't have that flag. But then ext4_readdir() always uses the 
> dx version, I guess in order to always return the same offset values 
> (in the sense of converting a non-dx dir to dx). In ext4_dir_llseek() I only 
> tested for the EXT4_INODE_INDEX flag, which is not correct in any case.
> So here is the patch, shall I sent an updated version of the previous ext4 patch 
> or is this patch sufficient?
> 
> Signed-off-by: Bernd Schubert <bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
> 
> diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
> index 71a66ff..6a19a35 100644
> --- a/fs/ext4/dir.c
> +++ b/fs/ext4/dir.c
> @@ -44,6 +44,24 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
>  	return (ext4_filetype_table[filetype]);
>  }
>  
> +/**
> + * Check if the given dir-inode refers to an htree indexed directory
> + *
> + * Return 1 if it is a dx dir, 0 if not
> + */
> +static int is_dx_dir(struct inode *inode)
> +{
> +	struct super_block *sb = inode->i_sb;
> +
> +	if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
> +		     EXT4_FEATURE_COMPAT_DIR_INDEX) &&
> +	    ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
> +	     ((inode->i_size >> sb->s_blocksize_bits) == 1)))
> +		return 1;
> +
> +	return 0;
> +}
> +
>  /*
>   * Return 0 if the directory entry is OK, and 1 if there is a problem
>   *
> @@ -99,18 +117,13 @@ static int ext4_readdir(struct file *filp,
>  	unsigned int offset;
>  	int i, stored;
>  	struct ext4_dir_entry_2 *de;
> -	struct super_block *sb;
>  	int err;
>  	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct super_block *sb = inode->i_sb;
>  	int ret = 0;
>  	int dir_has_error = 0;
>  
> -	sb = inode->i_sb;
> -
> -	if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
> -				    EXT4_FEATURE_COMPAT_DIR_INDEX) &&
> -	    ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
> -	     ((inode->i_size >> sb->s_blocksize_bits) == 1))) {
> +	if (is_dx_dir(inode)) {
>  		err = ext4_dx_readdir(filp, dirent, filldir);
>  		if (err != ERR_BAD_DX_DIR) {
>  			ret = err;
> @@ -308,7 +321,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  {
>  	struct inode *inode = file->f_mapping->host;
>  	loff_t ret = -EINVAL;
> -	int is_dx_dir = ext4_test_inode_flag(inode, EXT4_INODE_INDEX);
> +	int dx_dir = is_dx_dir(inode);
>  
>  	mutex_lock(&inode->i_mutex);
>  
> @@ -323,7 +336,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  
>  		/* so only negative offsets are left, does that have a
>  		 * meaning for directories at all? */
> -		if (is_dx_dir)
> +		if (dx_dir)
>  			offset += ext4_get_htree_eof(file);
>  		else
>  			offset += inode->i_size;
> @@ -347,7 +360,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  	if (unlikely(offset < 0))
>  		goto out_err;
>  
> -	if (!is_dx_dir) {
> +	if (!dx_dir) {
>  		if (offset > inode->i_sb->s_maxbytes)
>  			goto out_err;
>  	} else if (offset > ext4_get_htree_eof(file))
> 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
Cc: "J. Bruce Fields" <bfields@redhat.com>,
	Bernd Schubert <bernd.schubert@fastmail.fm>,
	"Ted Ts'o" <tytso@mit.edu>,
	linux-nfs@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, yong.fan@whamcloud.com,
	sandeen@redhat.com, adilger@whamcloud.com
Subject: Re: [PATCH 5 3/4] nfsd_open(): rename 'int access' to 'int may_flags' in nfsd_open()
Date: Thu, 12 Apr 2012 16:49:48 -0400	[thread overview]
Message-ID: <20120412204948.GE6667@fieldses.org> (raw)
In-Reply-To: <4F60AC0D.9020204@itwm.fraunhofer.de>

On Wed, Mar 14, 2012 at 03:32:45PM +0100, Bernd Schubert wrote:
> On 03/13/2012 10:29 PM, J. Bruce Fields wrote:
> > On Tue, Mar 13, 2012 at 10:09:05PM +0100, Bernd Schubert wrote:
> >> Hmm, there must have gone something wrong on merging,
> >
> > In that case one approach would be to rebase your last-sent patches on
> > to the same base as Ted's versions, confirm that one still works and the
> > other doesn't, and do a diff....
> >
> >> my own test
> >> also fails
> >>
> >> http://www.pci.uni-heidelberg.de/tc/usr/bernd/downloads/test_seekdir/
> >>
> >> (Sorry, it does not say 'failure', but one needs to compare the file
> >> names and telldir-offset numbers)
> >>
> >> I think I will continue in the morning as its already 1 a.m. here.
> >
> > OK, thanks for following up!

Stupid question: is there any fundamental feature of ext4 this depends
on, or would this fix work equally well for fs/ext3?

--b.

> 
> Took me some time to figure out what is going on and in the end I previously forgot 
> another test case - I always tested directories being sufficiently large, so that 
> they got the EXT4_INODE_INDEX flag. However, the cython tests failed on a small 
> directory, which doesn't have that flag. But then ext4_readdir() always uses the 
> dx version, I guess in order to always return the same offset values 
> (in the sense of converting a non-dx dir to dx). In ext4_dir_llseek() I only 
> tested for the EXT4_INODE_INDEX flag, which is not correct in any case.
> So here is the patch, shall I sent an updated version of the previous ext4 patch 
> or is this patch sufficient?
> 
> Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
> 
> diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
> index 71a66ff..6a19a35 100644
> --- a/fs/ext4/dir.c
> +++ b/fs/ext4/dir.c
> @@ -44,6 +44,24 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
>  	return (ext4_filetype_table[filetype]);
>  }
>  
> +/**
> + * Check if the given dir-inode refers to an htree indexed directory
> + *
> + * Return 1 if it is a dx dir, 0 if not
> + */
> +static int is_dx_dir(struct inode *inode)
> +{
> +	struct super_block *sb = inode->i_sb;
> +
> +	if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
> +		     EXT4_FEATURE_COMPAT_DIR_INDEX) &&
> +	    ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
> +	     ((inode->i_size >> sb->s_blocksize_bits) == 1)))
> +		return 1;
> +
> +	return 0;
> +}
> +
>  /*
>   * Return 0 if the directory entry is OK, and 1 if there is a problem
>   *
> @@ -99,18 +117,13 @@ static int ext4_readdir(struct file *filp,
>  	unsigned int offset;
>  	int i, stored;
>  	struct ext4_dir_entry_2 *de;
> -	struct super_block *sb;
>  	int err;
>  	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct super_block *sb = inode->i_sb;
>  	int ret = 0;
>  	int dir_has_error = 0;
>  
> -	sb = inode->i_sb;
> -
> -	if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
> -				    EXT4_FEATURE_COMPAT_DIR_INDEX) &&
> -	    ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
> -	     ((inode->i_size >> sb->s_blocksize_bits) == 1))) {
> +	if (is_dx_dir(inode)) {
>  		err = ext4_dx_readdir(filp, dirent, filldir);
>  		if (err != ERR_BAD_DX_DIR) {
>  			ret = err;
> @@ -308,7 +321,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  {
>  	struct inode *inode = file->f_mapping->host;
>  	loff_t ret = -EINVAL;
> -	int is_dx_dir = ext4_test_inode_flag(inode, EXT4_INODE_INDEX);
> +	int dx_dir = is_dx_dir(inode);
>  
>  	mutex_lock(&inode->i_mutex);
>  
> @@ -323,7 +336,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  
>  		/* so only negative offsets are left, does that have a
>  		 * meaning for directories at all? */
> -		if (is_dx_dir)
> +		if (dx_dir)
>  			offset += ext4_get_htree_eof(file);
>  		else
>  			offset += inode->i_size;
> @@ -347,7 +360,7 @@ loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin)
>  	if (unlikely(offset < 0))
>  		goto out_err;
>  
> -	if (!is_dx_dir) {
> +	if (!dx_dir) {
>  		if (offset > inode->i_sb->s_maxbytes)
>  			goto out_err;
>  	} else if (offset > ext4_get_htree_eof(file))
> 
> 
> 
> 

  parent reply	other threads:[~2012-04-12 20:49 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 13:21 [PATCH 0/4] [RESEND] 32/64 bit llseek hashes (v5) Bernd Schubert
2012-01-09 13:21 ` [PATCH 5 1/4] Add new FMODE flags: FMODE_32bithash and FMODE_64bithash Bernd Schubert
2012-01-09 13:21 ` [PATCH 5 2/4] Return 32/64-bit dir name hash according to usage type Bernd Schubert
2012-03-05 15:59   ` Ted Ts'o
     [not found]     ` <20120305155939.GE21356-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-06  0:40       ` Bernd Schubert
2012-03-06  0:40         ` Bernd Schubert
2012-03-06  2:28         ` Ted Ts'o
     [not found]           ` <20120306022838.GA24323-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-06  9:59             ` Bernd Schubert
2012-03-06  9:59               ` Bernd Schubert
     [not found]               ` <4F55E01B.3060105-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2012-03-06 15:15                 ` Ted Ts'o
2012-03-06 15:15                   ` Ted Ts'o
     [not found]                   ` <20120306151543.GA32282-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-07  9:01                     ` Bernd Schubert
2012-03-07  9:01                       ` Bernd Schubert
     [not found]   ` <20120109132148.2616029.68798.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2012-04-20 20:04     ` Eric Sandeen
2012-04-20 20:04       ` Eric Sandeen
     [not found]       ` <4F91C15B.6070200-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-22 12:51         ` Bernd Schubert
2012-04-22 12:51           ` Bernd Schubert
2012-04-23 20:37           ` Eric Sandeen
     [not found]             ` <4F95BD72.6090200-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-23 20:52               ` Bernd Schubert
2012-04-23 20:52                 ` Bernd Schubert
2012-04-23 21:22                 ` Eric Sandeen
     [not found]                 ` <4F95C109.1030401-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2012-04-23 22:23                   ` Eric Sandeen
2012-04-23 22:23                     ` Eric Sandeen
2012-04-23 22:42                     ` Andreas Dilger
     [not found]                       ` <A754D23B-B946-4E80-ACEA-0E2C2E6FAA2E-KloliPT79xf2eFz/2MeuCQ@public.gmane.org>
2012-04-24 16:10                         ` Bernd Schubert
2012-04-24 16:10                           ` Bernd Schubert
2012-04-24 19:21                           ` Eric Sandeen
2012-04-24 21:07                             ` Bernd Schubert
2012-04-24 22:24                               ` Andreas Dilger
2012-04-25 15:05                                 ` Eric Sandeen
2012-04-25 15:12                                   ` Bernd Schubert
2012-04-25 15:36                                     ` Eric Sandeen
2012-04-24 21:28                             ` Andreas Dilger
2012-04-24 21:26                               ` Eric Sandeen
2012-01-09 13:21 ` [PATCH 5 3/4] nfsd_open(): rename 'int access' to 'int may_flags' in nfsd_open() Bernd Schubert
2012-01-09 13:21 ` [PATCH 5 4/4] nfsd: vfs_llseek() with 32 or 64 bit offsets (hashes) Bernd Schubert
     [not found]   ` <20120109132158.2616029.30467.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
     [not found]     ` <20120109132153.2616029.26302.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2012-03-06  0:08       ` [PATCH 5 3/4] nfsd_open(): rename 'int access' to 'int may_flags' in nfsd_open() Ted Ts'o
2012-03-06  0:08         ` Ted Ts'o
     [not found]         ` <20120306000837.GA17164-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-06  2:08           ` J. Bruce Fields
2012-03-06  2:08             ` J. Bruce Fields
2012-03-06 15:18             ` Ted Ts'o
2012-03-06 15:28               ` J. Bruce Fields
2012-03-09 20:51                 ` Ted Ts'o
     [not found]                   ` <20120309205148.GB5635-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-12 15:09                     ` Ted Ts'o
2012-03-12 15:09                       ` Ted Ts'o
     [not found]                       ` <20120312150912.GB12440-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-12 15:49                         ` J. Bruce Fields
2012-03-12 15:49                           ` J. Bruce Fields
2012-03-12 22:22                           ` J. Bruce Fields
2012-03-13 20:01                             ` J. Bruce Fields
     [not found]                               ` <20120313200117.GA21991-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-03-13 20:03                                 ` Bernd Schubert
2012-03-13 20:03                                   ` Bernd Schubert
     [not found]                                   ` <4F5FA827.8020606-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2012-03-13 20:34                                     ` J. Bruce Fields
2012-03-13 20:34                                       ` J. Bruce Fields
2012-03-13 21:09                                       ` Bernd Schubert
2012-03-13 21:29                                         ` J. Bruce Fields
     [not found]                                           ` <20120313212947.GK31995-spRCxval1Z7TsXDwO4sDpg@public.gmane.org>
2012-03-14 14:32                                             ` Bernd Schubert
2012-03-14 14:32                                               ` Bernd Schubert
     [not found]                                               ` <4F60AC0D.9020204-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
2012-03-14 16:05                                                 ` J. Bruce Fields
2012-03-14 16:05                                                   ` J. Bruce Fields
     [not found]                                                   ` <20120314160529.GB31194-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-03-16 21:22                                                     ` Bernd Schubert
2012-03-16 21:22                                                       ` Bernd Schubert
2012-03-19  2:54                                                       ` Ted Ts'o
     [not found]                                                         ` <20120319025455.GD31682-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-19 20:00                                                           ` J. Bruce Fields
2012-03-19 20:00                                                             ` J. Bruce Fields
     [not found]                                                             ` <20120319200041.GA25161-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-03-20  0:10                                                               ` Ted Ts'o
2012-03-20  0:10                                                                 ` Ted Ts'o
2012-04-12 20:49                                                 ` J. Bruce Fields [this message]
2012-04-12 20:49                                                   ` J. Bruce Fields
     [not found]                                                   ` <20120412204948.GE6667-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-04-12 21:22                                                     ` Bernd Schubert
2012-04-12 21:22                                                       ` Bernd Schubert
     [not found]                                                       ` <4F8747A1.8060800-97jfqw80gc6171pxa8y+qA@public.gmane.org>
2012-04-12 21:25                                                         ` J. Bruce Fields
2012-04-12 21:25                                                           ` J. Bruce Fields
     [not found]                                       ` <20120313203446.GB21991-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-03-13 21:10                                         ` Ted Ts'o
2012-03-13 21:10                                           ` Ted Ts'o
     [not found]                                           ` <20120313211009.GA11969-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2012-03-13 21:27                                             ` J. Bruce Fields
2012-03-13 21:27                                               ` J. Bruce Fields
2012-01-10 11:27 ` [PATCH 0/4] [RESEND] 32/64 bit llseek hashes (v5) Andreas Dilger
2012-01-11 14:48   ` J. Bruce Fields
     [not found]     ` <20120111144827.GA32381-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2012-01-11 15:31       ` Ted Ts'o
2012-01-11 15:31         ` Ted Ts'o
2012-03-05 12:23         ` Bernd Schubert

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=20120412204948.GE6667@fieldses.org \
    --to=bfields-uc3wqj2krung9huczpvpmw@public.gmane.org \
    --cc=adilger-KloliPT79xf2eFz/2MeuCQ@public.gmane.org \
    --cc=bernd.schubert-97jfqw80gc6171pxa8y+qA@public.gmane.org \
    --cc=bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org \
    --cc=bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sandeen-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.org \
    --cc=yong.fan-KloliPT79xf2eFz/2MeuCQ@public.gmane.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 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.