[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120314160529.GB31194@fieldses.org>
Date: Wed, 14 Mar 2012 12:05:29 -0400
From: "J. Bruce Fields" <bfields@...ldses.org>
To: Bernd Schubert <bernd.schubert@...m.fraunhofer.de>
Cc: "J. Bruce Fields" <bfields@...hat.com>,
Bernd Schubert <bernd.schubert@...tmail.fm>,
Ted Ts'o <tytso@....edu>, linux-nfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
yong.fan@...mcloud.com, sandeen@...hat.com, adilger@...mcloud.com
Subject: Re: [PATCH 5 3/4] nfsd_open(): rename 'int access' to 'int
may_flags' in nfsd_open()
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!
>
> 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,
Yep, that passes my usual tests now, thanks!
> shall I sent an updated version of the previous ext4 patch
> or is this patch sufficient?
Up to Ted.
Ted, I haven't published my merge of your branch, so at least for my
purposes I don't care whether you fold this in or pop another patch on
top.
--b.
>
> Signed-off-by: Bernd Schubert <bernd.schubert@...m.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))
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists