[linux-cifs-client] Re: [PATCH COW] sys_copyfile

Jörn Engel joern at wohnheim.fh-wedel.de
Tue Apr 27 16:42:20 GMT 2004


On Tue, 27 April 2004 10:58:25 -0500, Steve French wrote:
> 
> > With warm cache, copyfile() is about 10% faster
> 
> Over the network it would be a lot more than that.

True, if network traffic is saved as well.

> in do_copyfile all I would need would be an op that looks a bit like 
> rename (the cifs vfs part of the changes, to fs/cifs/cifssmb.c mostly,
> would be trivial) e.g.:
> 
>  int do_copyfile(struct nameidata *old_nd, struct nameidata *new_nd,
>                  struct dentry *new_dentry, umode_t mode)
> {
> -	int ret;
> +       int ret = 0;
> 
>         if (!old_nd->dentry->d_inode)
>                 return -ENOENT;
>         if (!S_ISREG(old_nd->dentry->d_inode->i_mode))
>                 return -EINVAL;
>         /* FIXME: replace with proper permission check */
>         if (new_dentry->d_inode)
>                 return -EEXIST;
> 
> +	if(old_nd->dentry->d_inode->i_op->copy) {
> +		ret = old_dir->i_op->copy(old_nd->dentry, 
> +			mode, new_dentry);
> +	}

Shouldn't it be rather

	if (old_nd->dentry->d_inode->i_op->copy)
		return old_nd->dentry->d_inode->i_op->copy(old_nd->dentry,
				mode, new_dentry);

or something similar?  The copy() effectively replaces the complete
create/sendfile/possibly-unlink series.

> 
> 	if(!ret)
> 		return ret;
> 	else
> 		ret = vfs_create(new_nd->dentry->d_inode,
> 			 new_dentry, mode, new_nd);
> 	if (ret)
>                 return ret;
> 
> 	ret = copy_data(old_nd->dentry, old_nd->mnt, new_dentry,
> 		new_nd->mnt);
> 
>         if (ret) {
>                 int error = vfs_unlink(new_nd->dentry->d_inode,
> 			new_dentry);
>                 BUG_ON(error);
>                /* FIXME: not sure if there are return value we 
> 			should not BUG()
> 	               * on */
>         }
>         return ret;
> }
> 	

Jörn

-- 
The grand essentials of happiness are: something to do, something to
love, and something to hope for.
-- Allan K. Chalmers


More information about the linux-cifs-client mailing list