Re: [PATCH 05/22][RFC] Unionfs: Copyup Functionality

Jan Engelhardt
2006-09-04T07:03:07Z

>+/* Determine the mode based on the copyup flags, and the existing dentry. */
>+static int copyup_permissions(struct super_block *sb,
>+ struct dentry *old_hidden_dentry,
>+ struct dentry *new_hidden_dentry)
>+{
>+ struct iattr newattrs;
>+ int err;
>+
>+ newattrs.ia_atime = old_hidden_dentry->d_inode->i_atime;
>+ newattrs.ia_mtime = old_hidden_dentry->d_inode->i_mtime;
>+ newattrs.ia_ctime = old_hidden_dentry->d_inode->i_ctime;

How about,

struct inode *ohi = old_hidden_dentry->d_inode;
newattrs.ia_atime = ohi->i_atime;

reduces typing a little.

>+ if (S_ISDIR(old_mode)) {
>+ args.u.mkdir.parent = new_hidden_parent_dentry->d_inode;
>+ args.u.mkdir.dentry = new_hidden_dentry;
>+ args.u.mkdir.mode = old_mode;

Like above maybe?

>+ } else {
>+ printk(KERN_ERR "Unknown inode type %d\n",
>+ old_mode);
>+ BUG();
>+ }

Is BUG the right thing, what do others think? (Using WARN, and set err to
something useful?)

>+ } while ((read_bytes > 0) && (len > 0));

-()

>+/* This function creates a copy of a file represented by 'file' which currently
>+ * resides in branch 'bstart' to branch 'new_bindex.
^

+'

>+struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
>+ int bindex)
>+{
>+ struct dentry *hidden_dentry;
>+
>+ hidden_dentry =
>+ create_parents_named(dir, dentry, dentry->d_name.name, bindex);
>+
>+ return (hidden_dentry);
>+}

{
return create_parents_named(dir, dentry, dentry->d_name.name, bindex);
}

>+struct dentry *create_parents_named(struct inode *dir, struct dentry *dentry,
>+ const char *name, int bindex)
>+{
>+ struct dentry **path = NULL;
>+ path = (struct dentry **)kzalloc(kmalloc_size, GFP_KERNEL);

Nocast.

>+ if (!path)
>+ ;

Woha?!

>+ tmp_path =
>+ (struct dentry **)kzalloc(kmalloc_size, GFP_KERNEL);

Nocast.

Jan Engelhardt
--

--
VGER BF report: H 0