#define TIMEOUT_MIN 1
#define TIMEOUT_MAX 1000000
#define TIMEOUT_DEF 30
-#define TIMEOUT_INFO "defaults to %d seconds. Controls the interval when the ODF\n" \
- "cleanup thread will wake up."
+#define TIMEOUT_INFO "defaults to %d seconds. Controls the interval when " \
+ "the ODF\ncleanup thread will wake up."
#define THRESH_BH "block_high_thresh"
#define THRESH_BH_MIN 1
#define THRESH_BH_MAX 99
#define THRESH_BH_DEF 80
-#define THRESH_BH_INFO "defaults to %d%%. The threshold of consumed disk blocks in\n" \
- "/odf, above which we begin cleaning. Must be higher than the value of\n" \
- THRESH_BL
+#define THRESH_BH_INFO "defaults to %d%%. The threshold of consumed disk " \
+ "blocks in\n/odf, above which we begin cleaning. Must be higher " \
+ "than the value of\n" THRESH_BL
#define THRESH_BL "block_low_thresh"
#define THRESH_BL_MIN 1
#define THRESH_BL_MAX 99
#define THRESH_BL_DEF 70
-#define THRESH_BL_INFO "defaults to %d%%. The threshold of consumed disk blocks in\n" \
- "/odf, we try to bring the system to after we begin cleaning. Must be\n" \
- "lower the value of " THRESH_BH
+#define THRESH_BL_INFO "defaults to %d%%. The threshold of consumed disk " \
+ "blocks in\n/odf, we try to bring the system to after we begin " \
+ "cleaning. Must be\nlower the value of " THRESH_BH
#define THRESH_IH "inode_high_thresh"
#define THRESH_IH_MIN 1
#define THRESH_IH_MAX 99
#define THRESH_IH_DEF 80
-#define THRESH_IH_INFO "defaults to %d%%. The threshold of consumed inodes in /odf,\n" \
- "above which we begin cleaning. Must be higher than the value of " THRESH_IL
+#define THRESH_IH_INFO "defaults to %d%%. The threshold of consumed inodes" \
+ " in /odf,\nabove which we begin cleaning. Must be higher than the " \
+ "value of " THRESH_IL
#define THRESH_IL "inode_low_thresh"
#define THRESH_IL_MIN 1
#define THRESH_IL_MAX 99
#define THRESH_IL_DEF 70
-#define THRESH_IL_INFO "defaults to %d%%. The threshold of consumed inodes in /odf,\n" \
- "we try to bring the system to after we begin cleaning. Must be lower than\n" \
- "the value of " THRESH_IH
+#define THRESH_IL_INFO "defaults to %d%%. The threshold of consumed inodes" \
+ " in /odf,\nwe try to bring the system to after we begin cleaning. " \
+ " Must be lower than\nthe value of " THRESH_IH
#define HELP_NAME "help"
struct unionfs_attribute {
if (!d_deleted(dentry))
unionfs_reinterpose(dentry);
- /*err = odf_copyup_link(sb, old_hidden_dentry, new_hidden_dentry, old_bindex, new_bindex);*/
+#if 0
+ /* XXX: why was this commented out? */
+ err = odf_copyup_link(sb, old_hidden_dentry, new_hidden_dentry,
+ old_bindex, new_bindex);
+#endif
goto out_unlock;
/* odf cache dir calls partial lookup which expects a locked dentry */
unionfs_lock_dentry(file->f_dentry);
- err = odf_cache_dir(file->f_dentry, odf_cache, &file->f_dentry->d_inode->i_mtime);
+ err = odf_cache_dir(file->f_dentry, odf_cache,
+ &file->f_dentry->d_inode->i_mtime);
unionfs_unlock_dentry(file->f_dentry);
if (err)
goto out;
}
/* Cache contents of dir to an odf/ic file */
-int odf_cache_dir(struct dentry *d_upper, struct dentry *d_odf, struct timespec *mtime)
+int odf_cache_dir(struct dentry *d_upper, struct dentry *d_odf,
+ struct timespec *mtime)
{
int err = 0;
struct dentry *hidden_dentry = NULL;
i_odf = d_odf->d_inode;
- /* compare mtimes, do not proceed if equal, do not check if retrying after -ENOSPC */
+ /*
+ * compare mtimes, do not proceed if equal, do not check if retrying
+ * after -ENOSPC
+ */
if (i_odf && i_odf->i_size && !cleaned) {
if(timespec_compare(&i_odf->i_mtime,mtime) >= 0)
goto out;
* b) silly rename if its not physically empty
* c) unlink if not a dir
*/
-int unionfs_force_rm(struct dentry *dentry, struct dentry **hidden_dentry, int bindex)
+int unionfs_force_rm(struct dentry *dentry, struct dentry **hidden_dentry,
+ int bindex)
{
struct super_block *sb;
int err;
/* check if dir is empty */
branchget(sb, bindex);
- err = check_empty_lower(*hidden_dentry, unionfs_lower_mnt_idx(dentry, bindex));
+ err = check_empty_lower(*hidden_dentry,
+ unionfs_lower_mnt_idx(dentry, bindex));
branchput(sb, bindex);
if (err == 0)
* Returns 1 if it manages to bring inodes/block below requested,
* threshold and 0 if not.
*/
-int odf_cleanup(struct odf_sb_info *odf, int mode, u64 b_to_free, u64 i_to_free)
+int odf_cleanup(struct odf_sb_info *odf, int mode, u64 b_to_free,
+ u64 i_to_free)
{
int err = 0;
struct file *file;
extern struct export_operations export_op_default;
-static struct dentry *__get_parent(struct super_block *sb, struct dentry *odf_dentry)
+static struct dentry *__get_parent(struct super_block *sb,
+ struct dentry *odf_dentry)
{
struct dentry *odf_root = UNIONFS_D(sb->s_root)->odf.dentry;
struct dentry *d, *d_parent, *parent, *child = NULL;
return ERR_PTR(-ENOMEM);
/* unionfs_get_parent already checks for this */
- BUG_ON(!odf_root->d_sb->s_export_op || !odf_root->d_sb->s_export_op->get_parent);
+ BUG_ON(!odf_root->d_sb->s_export_op ||
+ !odf_root->d_sb->s_export_op->get_parent);
__odf_dstack_init(&stack, 8);
if (!stack.item)
* searches the cached dir in odf to find a dirent with
* the same inode number as the child, and returns that.
*/
-static int unionfs_get_name(struct dentry *dentry, char *name, struct dentry *child)
+static int unionfs_get_name(struct dentry *dentry, char *name,
+ struct dentry *child)
{
int err;
struct inode *dir = dentry->d_inode;
*
* @sb: unionfs's super_block
*/
-struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb, int flag)
+struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
+ int flag)
{
struct inode *hidden_inode;
struct dentry *hidden_dentry;
if (!odf_is_new(odf)) {
odf_options = odf_read_sb_data(odf, &bid);
if (IS_ERR(odf_options)) {
- printk(KERN_WARNING "unionfs_read_super: could not load options from odf\n");
+ printk(KERN_WARNING "unionfs_read_super: could not "
+ "load options from odf\n");
err = PTR_ERR(odf_options);
odf_options = NULL;
goto out_free_odf;
* Copyright (c) 2003 Puja Gupta
* Copyright (c) 2003 Harikesavan Krishnan
* Copyright (c) 2003-2007 Stony Brook University
- * Copyright (c) 2003-2007 The Research Foundation of State University of New York
+ * Copyright (c) 2003-2007 The Research Foundation of SUNY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
/* Create a directory in odf
* Fails if the directory already exists
*/
-static inline struct dentry * __odf_create_dir(struct dentry *parent, char *name)
+static inline struct dentry * __odf_create_dir(struct dentry *parent,
+ char *name)
{
struct dentry *dentry = NULL;
int err;
}
/*
- * Update the original inode's copyup info in the link file, and then for each entry
- * in the file, create parent hierarchies in the copied up branch and link to the new_dentry
+ * Update the original inode's copyup info in the link file, and then for
+ * each entry in the file, create parent hierarchies in the copied up branch
+ * and link to the new_dentry
*/
-int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry, struct dentry *new_dentry,
- int old_branch, int new_branch)
+int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
+ struct dentry *new_dentry, int old_branch, int new_branch)
{
char *name, *uuid;
struct dentry *links = NULL;
__le32 le32;
BUG_ON(S_ISDIR(old_dentry->d_inode->i_mode));
- /* do nothing if this has no links? or should we actually check if it has a link file? */
+ /*
+ * do nothing if this has no links? or should we actually check if
+ * it has a link file?
+ */
if (old_dentry->d_inode->i_nlink <= 1)
return 0;
return err;
}
-/* Checks the link file if the hard link was copied up, and if yes tries to link to the
- * copied up inode in the copied up branch.
+/*
+ * Checks the link file if the hard link was copied up, and if yes tries to
+ * link to the copied up inode in the copied up branch.
*/
-int __check_link_copyup(struct file *link_file, struct dentry *dentry, int branch_src)
+int __check_link_copyup(struct file *link_file, struct dentry *dentry,
+ int branch_src)
{
struct dentry *lower_dentry;
int err, bid = -1;
;
}
- /* case 3:
- * - dst to the right of src, because of moving branches, so if the file was already
- * copied up before the branch manipulation; it would now be hidden by the old non-copied up
- * version of the file.
+ /*
+ * case 3:
+ *
+ * - dst to the right of src, because of moving branches, so if the
+ * file was already copied up before the branch manipulation; it
+ * would now be hidden by the old non-copied up version of the file.
+ *
* - Do nothing!
*/
else if (branch_dst < branch_src) {
* @len: length of the name
* @flags: ODF_LOOKUP_ flags (see above)
*/
-struct dentry *odf_lookup_name(struct dentry *parent, const char *name, int len, int flags)
+struct dentry *odf_lookup_name(struct dentry *parent, const char *name,
+ int len, int flags)
{
return __odf_lookup(parent, NULL, name, len, flags, NULL);
}
* Returns odf_dentry_info pointing to the location in odf/ic
* for the requested file name
*/
-struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name, int namelen)
+struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name,
+ int namelen)
{
struct dentry *dirs[4], *ic, *ret = NULL;
int breakdown[4];
* Generates uuids for branches and makes sure branches belonging to the same
* file system get the same UUID.
*/
-int odf_update_uuids(struct odf_sb_info *odf, struct path *old_paths, int old_branches,
- struct path *new_paths, int new_branches)
+int odf_update_uuids(struct odf_sb_info *odf, struct path *old_paths,
+ int old_branches, struct path *new_paths,
+ int new_branches)
{
struct vfsmount *m;
char *old_uuids = odf->branch_uuids;
* then for each branch:
* branch id, absolute path len, absolute path, perms, uuids
*/
-int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data, struct path *lower_paths, int branches)
+int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
+ struct path *lower_paths, int branches)
{
struct dentry *d, *d_content;
struct vfsmount *m, *odf_mnt;
extern int odf_read_super(struct super_block *sb, char *data);
extern void odf_put_super(struct odf_sb_info *osi);
extern char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid);
-extern int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
- struct path *lower_paths, int branches);
+extern int odf_write_sb_data(struct odf_sb_info *osi,
+ struct unionfs_data *data,
+ struct path *lower_paths, int branches);
extern int odf_is_new(struct odf_sb_info *osi);
-extern int odf_update_uuids(struct odf_sb_info *odf, struct path *old_paths, int old_branches,
- struct path *new_paths, int new_branches);
+extern int odf_update_uuids(struct odf_sb_info *odf, struct path *old_paths,
+ int old_branches, struct path *new_paths,
+ int new_branches);
/* lookup */
extern int odf_lookup(struct dentry *parent, struct dentry *dentry, int flags);
-extern struct dentry *odf_lookup_name(struct dentry *parent, const char *name, int len, int flags);
+extern struct dentry *odf_lookup_name(struct dentry *parent, const char *name,
+ int len, int flags);
/* dirents & dir cache */
extern struct dentry *odf_ic_cache_dentry(struct dentry *dir);
-extern int odf_write_dirent(struct file *filp, const char *name, int namelen, u64 ino, unsigned int d_type);
-extern int odf_read_dirent(struct file *filp, char **name, int *namelen, u64 *ino, unsigned int *d_type);
+extern int odf_write_dirent(struct file *filp, const char *name, int namelen,
+ u64 ino, unsigned int d_type);
+extern int odf_read_dirent(struct file *filp, char **name, int *namelen,
+ u64 *ino, unsigned int *d_type);
extern int odf_purge_dir_cache(struct dentry *dentry);
-extern int odf_cache_dir(struct dentry *d_upper, struct dentry *d_odf, struct timespec *mtime);
+extern int odf_cache_dir(struct dentry *d_upper, struct dentry *d_odf,
+ struct timespec *mtime);
extern int odf_release_sr(struct inode *inode);
/* various i-ops */
extern int odf_rename(struct dentry *old_dentry, struct dentry *new_dentry);
extern int odf_link(struct dentry *old_dentry, struct dentry *new_dentry);
-extern int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry, struct dentry *new_dentry,
- int old_branch, int new_branch);
+extern int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
+ struct dentry *new_dentry,
+ int old_branch, int new_branch);
/* unlink */
extern int odf_remove(struct dentry *dentry, int flags);
int odf_set_opaque(struct dentry *odf_dentry, int branch);
/* cleanup thread functions */
-int odf_cleanup(struct odf_sb_info *odf, int mode, u64 b_to_free, u64 i_to_free);
+int odf_cleanup(struct odf_sb_info *odf, int mode, u64 b_to_free,
+ u64 i_to_free);
extern void generate_random_uuid(unsigned char uuid_out[16]);
goto revert_out;
}
- local_err = __unionfs_rename(new_dir, new_dentry, old_dir, old_dentry, old_bstart);
+ local_err = __unionfs_rename(new_dir, new_dentry, old_dir,
+ old_dentry, old_bstart);
/* If we can't fix it, then we cop-out with -EIO. */
if (local_err) {
* and terminates if done, otherwise repeats the loop.
* The done function should return 0 if not done.
*/
-void run_sioa(struct sioa_args *args, void (*work) (void*), signed long timeout)
+void run_sioa(struct sioa_args *args, void (*work) (void*),
+ signed long timeout)
{
init_completion(&args->comp_thread);
mutex_init(&args->lock);
extern int __init init_sioq(void);
extern __exit void stop_sioq(void);
extern void run_sioq(work_func_t func, struct sioq_args *args);
-extern void run_sioa(struct sioa_args *args, void (*work) (void*), signed long timeout);
+extern void run_sioa(struct sioa_args *args, void (*work) (void*),
+ signed long timeout);
extern void wake_up_and_wait_sioa(struct sioa_args *args);
extern void wake_up_sioa(struct sioa_args *args);
extern void complete_sioa(struct sioa_args *args);
extern void unionfs_destroy_dentry_cache(void);
/* Initialize and free readdir-specific state. */
-extern struct unionfs_dir_state *alloc_rdstate(struct inode *inode, int bindex);
+extern struct unionfs_dir_state *alloc_rdstate(struct inode *inode,
+ int bindex);
extern void free_rdstate(struct unionfs_dir_state *state);
-extern int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name,
- int namelen, int bindex, int whiteout);
+extern int add_filldir_node(struct unionfs_dir_state *rdstate,
+ const char *name, int namelen, int bindex,
+ int whiteout);
extern struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,
const char *name, int namelen);
#define MAXRDCOOKIE (0xfff)
/* Is this directory empty: 0 if it is empty, -ENOTEMPTY if not. */
extern int check_empty(struct dentry *dentry,
struct unionfs_dir_state **namelist);
-extern int check_empty_lower(struct dentry *lower_dentry, struct vfsmount *mnt);
+extern int check_empty_lower(struct dentry *lower_dentry,
+ struct vfsmount *mnt);
/* Re-lookup a hidden dentry. */
extern int unionfs_refresh_hidden_dentry(struct dentry *dentry, int bindex);
extern int unionfs_rmdir(struct inode *dir, struct dentry *dentry);
int __unionfs_d_revalidate_chain(struct dentry *dentry, struct nameidata *nd);
-int unionfs_force_rm(struct dentry *dentry, struct dentry **hidden_dentry, int bindex);
+int unionfs_force_rm(struct dentry *dentry, struct dentry **hidden_dentry,
+ int bindex);
int unionfs_silly_rename(struct dentry *dentry, struct dentry *hidden_dentry);
/* The values for unionfs_interpose's flag. */
mntput(mnt);
}
-/* a stack for dentries amd its ops, used by odf cleanup thread and get_parent */
+/*
+ * a stack for dentries amd its ops, used by odf cleanup thread and
+ * get_parent
+ */
struct dentry_stack {
struct dentry **item;
int n;
stack->item = kmalloc(stack->size * sizeof(struct dentry *), GFP_KERNEL);
}
-static inline int __odf_dstack_push(struct dentry_stack *stack, struct dentry *dentry)
+static inline int __odf_dstack_push(struct dentry_stack *stack,
+ struct dentry *dentry)
{
stack->item[stack->n++] = dentry;
if (stack->n == stack->size)
/* useful for tracking code reachability */
#define UDBG printk("DBG:%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__)
-#define unionfs_check_inode(i) __unionfs_check_inode((i),__FILE__,__FUNCTION__,__LINE__)
-#define unionfs_check_dentry(d) __unionfs_check_dentry((d),__FILE__,__FUNCTION__,__LINE__)
-#define unionfs_check_file(f) __unionfs_check_file((f),__FILE__,__FUNCTION__,__LINE__)
-#define show_branch_counts(sb) __show_branch_counts((sb),__FILE__,__FUNCTION__,__LINE__)
-extern void __unionfs_check_inode(const struct inode *inode,
- const char *fname, const char *fxn, int line);
+#define unionfs_check_inode(i) __unionfs_check_inode((i),\
+ __FILE__,__FUNCTION__,__LINE__)
+#define unionfs_check_dentry(d) __unionfs_check_dentry((d),\
+ __FILE__,__FUNCTION__,__LINE__)
+#define unionfs_check_file(f) __unionfs_check_file((f),\
+ __FILE__,__FUNCTION__,__LINE__)
+#define show_branch_counts(sb) __show_branch_counts((sb),\
+ __FILE__,__FUNCTION__,__LINE__)
+extern void __unionfs_check_inode(const struct inode *inode, const char *fname,
+ const char *fxn, int line);
extern void __unionfs_check_dentry(const struct dentry *dentry,
- const char *fname, const char *fxn, int line);
-extern void __unionfs_check_file(const struct file *file,
- const char *fname, const char *fxn, int line);
+ const char *fname, const char *fxn,
+ int line);
+extern void __unionfs_check_file(const struct file *file, const char *fname,
+ const char *fxn, int line);
extern void __show_branch_counts(const struct super_block *sb,
const char *file, const char *fxn, int line);
if (err)
break;
}
- /* FIXME: create wh for opaque dirs as well? or force to check all branches? */
+ /*
+ * FIXME: create wh for opaque dirs as well? or force to check all
+ * branches?
+ */
if (err || odf_get_opaque(dentry) != 1) {
if (err == -EIO)
printk(KERN_WARNING