return err;
}
-/* Same as copyup_deleted_file, but with rename instead of copyup
+/*
+ * Same as copyup_deleted_file, but with rename instead of copyup
*/
int unionfs_silly_rename(struct dentry *dentry, struct dentry *hidden_dentry)
{
return err;
}
-/* put all references held by upper struct file and free lower file pointer
+/*
+ * put all references held by upper struct file and free lower file pointer
* array
*/
static void cleanup_file(struct file *file)
< 0)
newest = &hidden_dentry->d_inode->i_mtime;
- /* The branchget goes after the open, because otherwise
+ /*
+ * The branchget goes after the open, because otherwise
* we would miss the reference on release.
*/
unionfs_read_lock(inode->i_sb);
dentry = file->f_dentry;
- /* FIXME: With nfs exporting we can get a disconnected dentry here.
+ /*
+ * FIXME: With nfs exporting we can get a disconnected dentry here.
* This can happen if the dcache is dropped on the server while the
* client is working, and export ops decodefh returns ESTALE to the
* user. It would best to catch this by implementing decodefh
int interpose_flag;
struct nameidata lowernd; /* TODO: be gentler to the stack */
- /* FIXME: with nfs exporting, if export ops fails to connect a dentry
+ /*
+ * FIXME: with nfs exporting, if export ops fails to connect a dentry
* and returns ESTALE to the client, we can end up with an inode that
* has ibstart -1. This fix only stops the oopsing but the dentry will
* become unusable on the client, it will keep getting ESTALE on any
if (err)
goto out;
- /* Reset file position, since an operation like rm *
+ /*
+ * Reset file position, since an operation like rm *
* will rm the 1st entry, purge and then try to
* readdir again after the 1st entry's pos and will
* resulting in error reading dirents or skipping files
/* save the file position */
file->f_pos = odf_file->f_pos;
- /* If EOF is reached, we set the file pos to the max possible value
+ /*
+ * If EOF is reached, we set the file pos to the max possible value
* since the file pos must be greater than the size of the file as
* viewed through the union and also odf cached file as not to
* confuse unionfs_/nfs_readdir when EOF is reached
(namelen == 1 || (name[1] == '.' && namelen == 2)))
goto out;
- /* remove dir cache files or all if files if cleaning
+ /*
+ * remove dir cache files or all if files if cleaning
* /odf/reclaim and /odf/sr
*/
if ((d_type == DT_REG && buf->mode != CLN_IC) ||
static int readdir_util_callback(void *dirent, const char *name, int namelen,
loff_t offset, u64 ino, unsigned int d_type)
{
- /* FIXME: Fix this so it doesn't store whiteouts and thus is more
+ /*
+ * FIXME: Fix this so it doesn't store whiteouts and thus is more
* efficient
*/
if (err || buf->mode != RD_CACHE_ODF || !buf->filp || whiteout)
goto out;
- /* Ideally we would want all entries we find here to be in the
+ /*
+ * Ideally we would want all entries we find here to be in the
* odf and have a persistent inode. However it is possible for the
* entries not to be in the odf yet, and thus not have a valid odf
* inode number. We could have created an entry in the odf at this
return err;
}
-/* Checks if the given directory is physically empty
+/*
+ * Checks if the given directory is physically empty
* Returns 0 if it is empty and -ENOTEMPTY if not
*/
int check_empty_lower(struct dentry *lower_dentry, struct vfsmount *mnt)
return err;
}
-/* Remove the hidden dentry by:
+/*
+ * Remove the hidden dentry by:
* a) rmdir if its a physically empty dir
* b) silly rename if its not physically empty
* c) unlink if not a dir
stack.item[stack.n++] = odf->ic;
cleanup_loop:
- /* The cleanup loop pops a dentry off the stack, reads all
+ /*
+ * The cleanup loop pops a dentry off the stack, reads all
* its entries, unlinking dir cache files and files in
* odf/reclaim and pushing to the stack all directories
*/
while (err >= 0 && stack.n > 0 && !success) {
dentry = __odf_dstack_pop(&stack);
- /* we need to dget /odf/reclaim and /odf/sr dirs again since
+ /*
+ * we need to dget /odf/reclaim and /odf/sr dirs again since
* we need them after we close the file
*/
if (buf->mode != CLN_IC)
fput(file);
if (!err && buf->mode != CLN_IC) {
- /* remove all directories in odf/reclaim or odf/sr
+ /*
+ * remove all directories in odf/reclaim or odf/sr
* This assumes that the odf/reclaim dir structure
* is entirely flat, ie only odf/reclaim contains
* subdirectories
if (!stack.item)
return ERR_PTR(-ENOMEM);
- /* first we need to follow the odf_dentry back to the root (/odf/ns)
+ /*
+ * first we need to follow the odf_dentry back to the root (/odf/ns)
* and keep track of the dentries we need to go through
*/
dget(odf_dentry);
dget(d);
}
else {
- /* if the odf dentry is disconnected we get its
+ /*
+ * if the odf dentry is disconnected we get its
* parent by calling get_parent on the odf fs
*/
mutex_lock(&d->d_inode->i_mutex);
hidden_dentry = unionfs_lower_dentry_idx(dentry, bstart);
if (!hidden_dentry) {
- /* if hidden_dentry is NULL, create the entire
+ /*
+ * if hidden_dentry is NULL, create the entire
* dentry directory structure in branch 'bindex'.
* hidden_dentry will NOT be null when bindex == bstart
* because lookup passed as a negative unionfs dentry
- * pointing to a lone negative underlying dentry */
+ * pointing to a lone negative underlying dentry
+ */
hidden_dentry = create_parents(parent, dentry,
dentry->d_name.name,
bstart);
hidden_dentry = unionfs_lower_dentry_idx(dentry, bstart);
if (!hidden_dentry) {
- /* if hidden_dentry is NULL, create the entire
+ /*
+ * if hidden_dentry is NULL, create the entire
* dentry directory structure in branch 'bindex'.
* hidden_dentry will NOT be null when bindex ==
* bstart because lookup passed as a negative
int namelen;
struct nameidata new_nd;
- /* We should already have a lock on this dentry in the case of a
+ /*
+ * We should already have a lock on this dentry in the case of a
* partial lookup, or a revalidation. Otherwise it is returned from
* new_dentry_private_data already locked.
*/
bopaque = odf_get_opaque(parent_dentry);
BUG_ON(bstart < 0);
- /* It would be ideal if we could convert partial lookups to only have
+ /*
+ * It would be ideal if we could convert partial lookups to only have
* to do this work when they really need to. It could probably improve
* performance quite a bit, and maybe simplify the rest of the code.
*/
if (IS_ERR(spliced))
err = PTR_ERR(spliced);
- /* d_splice can return a dentry if it was disconnected
+ /*
+ * d_splice can return a dentry if it was disconnected
* and had to be moved. We must make sure that the pd
* of the new dentry is correct and that the inode info
* was filled properly. Finally we must return this new
init_rwsem(&UNIONFS_SB(sb)->rwsem);
UNIONFS_SB(sb)->high_branch_id = -1; /* -1 == invalid branch ID */
- /* get the odf super block
+ /*
+ * get the odf super block
* Try to extract the odf option from the mount time options and
* then initialize odf sb data
*/
}
out_free_odf:
- /* cleanup thread is not started,free it here so
- * odf_put_super doesn't wait for it */
+ /*
+ * cleanup thread is not started,free it here so
+ * odf_put_super doesn't wait for it
+ */
kfree(UNIONFS_SB(sb)->odf.cleanup);
UNIONFS_SB(sb)->odf.cleanup = NULL;
odf_put_super(&UNIONFS_SB(sb)->odf);
page_data = (char *)kmap(page);
lower_file->f_pos = (page->index << PAGE_CACHE_SHIFT) + from;
- /* SP: I use vfs_write instead of copying page data and the
+ /*
+ * SP: I use vfs_write instead of copying page data and the
* prepare_write/commit_write combo because file system's like
* GFS/OCFS2 don't like things touching those directly,
* calling the underlying write op, while a little bit slower, will
#include "union.h"
#include "odf_internals.h"
-/* Create a directory in odf
+/*
+ * Create a directory in odf
* Fails if the directory already exists
*/
static inline struct dentry * __odf_create_dir(struct dentry *parent,
return dentry;
}
-/* Creates the hierarchy for a fresh odf file.
+/*
+ * Creates the hierarchy for a fresh odf file.
* It fails if any of the dirs/files to be created existed before
*/
int __odf_create_hierarchy(struct dentry *odf_root)
return dentry;
}
-/* parses the given options looking for odf-related options
+/*
+ * parses the given options looking for odf-related options
* On success odf_path will contain the path to the odf file and
* the return value can contain a combination of these flags:
* ODF_OPT_KEEPCACHE and ODF_OPT_DIRS
if (!strcmp("dirs", optname))
err |= ODF_OPT_DIRS;
- /* don't throw error on unrecognized args because this will
+ /*
+ * don't throw error on unrecognized args because this will
* be caught by unionfs_parse_options, we should only be
* worried with options that affect the odf
*/
return err;
}
-/* Adds a dirent to the inode's hardlink info file if it doesn't exist.
+/*
+ * Adds a dirent to the inode's hardlink info file if it doesn't exist.
* If the file was empty, fills in the copyup info (branch and inum) with 0's
* If the file was not empty returns the odf dentry of one of the links for the
* odf to link to it. (We might need to store the odf inum parent as well)
filp_close(link_file, NULL);
link_file = NULL;
- /* XXX: create parent hierarchies in new_branch for all other links
+ /*
+ * XXX: create parent hierarchies in new_branch for all other links
* and link to the new_dentry
*/
if (!ino)
goto out;
- /* XXX: the copied up file might have been copied up again, so we
+ /*
+ * XXX: the copied up file might have been copied up again, so we
* need to check that too in order to find the final dst branch
*/
if (branch_dst >= 0)
dst_ro = is_robranch_super(dentry->d_sb, branch_dst);
- /* case 0:
+ /*
+ * case 0:
* - dest branch id has changed because of remounts
* - do not copyup, remove copyup info from link info file
*/
err = 0;
}
- /* case 1:
+ /*
+ * case 1:
* - Normal case, dst to the left of src and not ro
* - create parent hierarchy and link in the dst branch
*/
/* now link */
}
- /* case 2:
+ /*
+ * case 2:
* - dst is the same as src branch and not ro
* - unlink old file and straight link with copied up
*/
;
}
- /* case 4:
+ /*
+ * case 4:
* - dst branch is ro
* - copyup again!
*/
* - ODF_LOOKUP_WH: create a whiteout
*/
-/* odf_lookup: This function should be used whenever we have a unionfs
+/*
+ * odf_lookup: This function should be used whenever we have a unionfs
* dentry and want to find its entry in the ODF. Before doing the lookup
* it checks for hardlinks and tries to lazily build up the links in the
* odf.
return err;
}
-/* odf_lookup_name: This function should be used whenever we don't have a
+/*
+ * odf_lookup_name: This function should be used whenever we don't have a
* unionfs dentry, but want to lookup a name in the odf. It should never
* be used to create entries in the odf, apart from whiteouts, since it
* does not handle hardlinks.
return __odf_lookup(parent, NULL, name, len, flags, NULL);
}
-/* __odf_lookup:looks up an entry in the odf, creates new entries if
+/*
+ * __odf_lookup:looks up an entry in the odf, creates new entries if
* required and handles hardlinks
*
* @parent: unionfs dir dentry
odf_set_opaque(odf_dentry, opaque);
}
else {
- /* hardlinks, check if link inode is same as odf_dentry inode,
- and if not, link them */
+ /*
+ * hardlinks, check if link inode is same as odf_dentry inode,
+ * and if not, link them
+ */
}
if (odf_dentry && !IS_ERR(odf_dentry)) {
odf_dentry = NULL;
}
}
- /* We return ENOENT if no entry is found, so the caller can
+ /*
+ * We return ENOENT if no entry is found, so the caller can
* distinguish between an entry not being in the odf and an
* entry that is in the odf but is a whiteout, (where NULL is
* is returned)
err = vfs_unlink(odf_dentry->d_parent->d_inode,
odf_dentry);
else
- /* silly rename open files, so their ino does
+ /*
+ * silly rename open files, so their ino does
* not get recycled while still open
*/
err = odf_reclaim(dentry, 1);
return err;
}
-/* The opaque number stored with the odf inode is that of the branch id
+/*
+ * The opaque number stored with the odf inode is that of the branch id
* which is not necessarily the same as the branch position, so we need to
* convert the branch id to the branch position
*/
i = branch_id_to_idx(sb, opaque);
- /* if this is reached then the opaque branch was deleted, so dentry
+ /*
+ * if this is reached then the opaque branch was deleted, so dentry
* can no longer be considered opaque
*/
if (i == -1)
bindex = 0;
if (S_ISDIR(old_dentry->d_inode->i_mode)) {
- /* at this point we can safely assume the directory
- * is logically empty, so mkdir at branch 0 */
-
+ /*
+ * at this point we can safely assume the directory
+ * is logically empty, so mkdir at branch 0
+ */
err = copyup_empty_dir(new_dir,
new_dentry,
old_dentry->d_inode->i_mode);
return err;
}
-/* We can't copyup a directory, because it may involve huge
+/*
+ * We can't copyup a directory, because it may involve huge
* numbers of children, etc. Doing that in the kernel would
* be bad, so instead we let the user-space recurse and ask us
* to copy up each file separately
if (err)
goto out;
- /* if the new dentry exists at branch 0 and is a whiteout
+ /*
+ * if the new dentry exists at branch 0 and is a whiteout
* or if it is a logically empty directory remove it,
- * since it will cause us problems when we copyup */
+ * since it will cause us problems when we copyup
+ */
hidden = unionfs_lower_dentry_idx(new_dentry, 0);
if (hidden && hidden->d_inode ) {
if (UNIONFS_D(new_dentry)->odf.whiteout) {
return 0;
}
-/* Creates an asynchronous thread. Calling process is responsible
+/*
+ * Creates an asynchronous thread. Calling process is responsible
* for calling wait_for_completion. The thread executes the work function,
* then sleeps for timeout time. When it wakes up it runs the done function
* and terminates if done, otherwise repeats the loop.
kernel_thread(__run_sioa, args, 0);
}
-/* Synchronous wake up an sioa thread, makes sure the thread
+/*
+ * Synchronous wake up an sioa thread, makes sure the thread
* finishes its work before the caller resumes
*/
void wake_up_and_wait_sioa(struct sioa_args *args)
#include "union.h"
-/* This is a helper function for rename, which ends up with hosed over dentries
+/*
+ * This is a helper function for rename, which ends up with hosed over dentries
* when it needs to revert.
*/
int unionfs_refresh_hidden_dentry(struct dentry *dentry, int bindex)
return err;
}
-/* returns the sum of the n_link values of all the underlying inodes of the
+/*
+ * returns the sum of the n_link values of all the underlying inodes of the
* passed inode
*/
int unionfs_get_nlinks(struct inode *inode)
if (err)
goto out_release;
- /* if odf_keepcache is not set, wake up the cleanup thread and force
+ /*
+ * if odf_keepcache is not set, wake up the cleanup thread and force
* it to cleanup everything
*/
if (!odf_keepcache) {
kfree(UNIONFS_I(inode)->lower_inodes);
UNIONFS_I(inode)->lower_inodes = NULL;
- /* if this inode has been silly renamed in the odf we can now safely
+ /*
+ * if this inode has been silly renamed in the odf we can now safely
* remove it from /odf/sr since it's not used anymore
*/
odf_release_sr(inode);
/* odf dentry data in memory */
struct odf_dentry_info {
- /* When a unionfs dentry is looked up in the odf, then:
+ /*
+ * When a unionfs dentry is looked up in the odf, then:
* - if its odf_dentry is NULL, it means it is not in the odf
* - if it is not NULL, it is in the odf and the whiteout field
* will denote that it is a whiteout if not set to 0
goto out;
}
- /* we want to update mtime here, since if the file to
+ /*
+ * we want to update mtime here, since if the file to
* be removed was only on a rd only branch, then since
* the mtime of that branch has not changed, so the
* mtime of the upper file is not updated
attr.ia_valid = ATTR_MTIME | ATTR_MTIME_SET | ATTR_FORCE;
err = notify_change(dentry->d_parent, &attr);
- /* XXX: ignore this error, for now, unionfs_setattr should
+ /*
+ * XXX: ignore this error, for now, unionfs_setattr should
* be modified to set the attributes in /odf/ns not lower
- * branches or set the odf mtime here */
+ * branches or set the odf mtime here
+ */
err = 0;
out:
/* call d_drop so the system "forgets" about us */
if (!err) {
- /* If there was a whiteout created then the original
+ /*
+ * If there was a whiteout created then the original
* ODF entry was removed and replaced by a previous call
* to create_whiteout. If not, the original entry is still
* here, so we just remove it only if its not a whiteout
goto out;
}
- /* we want to update mtime here, since if the file to
+ /*
+ * we want to update mtime here, since if the file to
* be removed was only on a rd only branch, then since
* the mtime of that branch has not changed, so the
* mtime of the upper file is not updated
attr.ia_valid = ATTR_MTIME | ATTR_MTIME_SET | ATTR_FORCE;
err = notify_change(dentry->d_parent, &attr);
- /* XXX: ignore this error, for now, unionfs_setattr should
+ /*
+ * XXX: ignore this error, for now, unionfs_setattr should
* be modified to set the attributes in /odf/ns not lower
- * branches or set the odf mtime here */
+ * branches or set the odf mtime here
+ */
err = 0;
out: