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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>+	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
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux