Re: [PATCH 04/22][RFC] Unionfs: Common file operations

Jan Engelhardt
2006-09-01T12:54:07Z

>+ if (!d_deleted(dentry) &&
>+ ((sbgen > fgen) || (dbstart(dentry) != fbstart(file)))) {

(sbgen > fgen || dbstart(dentry) != fbstart(file)) should suffice. (Read:
reduce the amount of "()" depth.)

>+int unionfs_file_release(struct inode *inode, struct file *file)
>+{
>+ int err = 0;
>+ struct file *hidden_file = NULL;
>+ int bindex, bstart, bend;
>+ int fgen;
>+
>+ /* fput all the hidden files */
>+ fgen = atomic_read(&ftopd(file)->ufi_generation);
>+ bstart = fbstart(file);
>+ bend = fbend(file);
>+
>+ for (bindex = bstart; bindex <= bend; bindex++) {
>+ hidden_file = ftohf_index(file, bindex);
>+
>+ if (hidden_file) {
>+ fput(hidden_file);
>+ unionfs_read_lock(inode->i_sb);
>+ branchput(inode->i_sb, bindex);
>+ unionfs_read_unlock(inode->i_sb);
>+ }
>+ }
>+ kfree(ftohf_ptr(file));
>+
>+ if (ftopd(file)->rdstate) {
>+ ftopd(file)->rdstate->uds_access = jiffies;
>+ printk(KERN_DEBUG "Saving rdstate with cookie %u [%d.%lld]\n",
>+ ftopd(file)->rdstate->uds_cookie,
>+ ftopd(file)->rdstate->uds_bindex,
>+ (long long)ftopd(file)->rdstate->uds_dirpos);
>+ spin_lock(&itopd(inode)->uii_rdlock);
>+ itopd(inode)->uii_rdcount++;
>+ list_add_tail(&ftopd(file)->rdstate->uds_cache,
>+ &itopd(inode)->uii_readdircache);
>+ mark_inode_dirty(inode);
>+ spin_unlock(&itopd(inode)->uii_rdlock);
>+ ftopd(file)->rdstate = NULL;
>+ }
>+ kfree(ftopd(file));
>+ return err;
>+}

"err" is unused in this function. Rid it.

>+ }
>+ }
>+
>+ }

Jan Engelhardt
--