Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'aufs2-32' into aufs2-33
Browse files Browse the repository at this point in the history
Conflicts:
	fs/aufs/f_op.c

Signed-off-by: J. R. Okajima <[email protected]>
  • Loading branch information
J. R. Okajima committed May 31, 2010
2 parents 943ac99 + 95ca1ab commit 5dc4cd3
Show file tree
Hide file tree
Showing 16 changed files with 370 additions and 231 deletions.
2 changes: 1 addition & 1 deletion fs/aufs/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
continue;
}

hf = au_h_fptr(file, bstart);
hf = au_hf_top(file);
FiMustNoWaiters(file);
fi_read_unlock(file);

Expand Down
5 changes: 2 additions & 3 deletions fs/aufs/cpup.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ static int au_do_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst,
hdp[0 + bdst].hd_dentry = wh_dentry;
h_d_start = hdp[0 + bstart].hd_dentry;
if (file)
hdp[0 + bstart].hd_dentry
= au_h_fptr(file, au_fbstart(file))->f_dentry;
hdp[0 + bstart].hd_dentry = au_hf_top(file)->f_dentry;
err = au_cpup_single(dentry, bdst, bstart, len, !AuCpup_DTIME,
/*h_parent*/NULL);
if (!err && file) {
Expand Down Expand Up @@ -914,7 +913,7 @@ int au_sio_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,

/* this temporary unlock is safe */
if (file)
h_dentry = au_h_fptr(file, au_fbstart(file))->f_dentry;
h_dentry = au_hf_top(file)->f_dentry;
else
h_dentry = au_h_dptr(dentry, au_dbstart(dentry));
h_inode = h_dentry->d_inode;
Expand Down
33 changes: 12 additions & 21 deletions fs/aufs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ static int do_pri_file(aufs_bindex_t bindex, struct file *file)
void au_dpri_file(struct file *file)
{
struct au_finfo *finfo;
struct au_fidir *fidir;
struct au_hfile *hfile;
aufs_bindex_t bindex;
int err;

Expand All @@ -213,14 +215,17 @@ void au_dpri_file(struct file *file)
finfo = au_fi(file);
if (!finfo)
return;
if (finfo->fi_bstart < 0)
if (finfo->fi_btop < 0)
return;
for (bindex = finfo->fi_bstart; bindex <= finfo->fi_bend; bindex++) {
struct au_hfile *hf;

hf = finfo->fi_hfile + bindex;
do_pri_file(bindex, hf ? hf->hf_file : NULL);
}
fidir = finfo->fi_hdir;
if (!fidir)
do_pri_file(finfo->fi_btop, finfo->fi_htop.hf_file);
else
for (bindex = finfo->fi_btop; bindex <= fidir->fd_bbot;
bindex++) {
hfile = fidir->fd_hfile + bindex;
do_pri_file(bindex, hfile ? hfile->hf_file : NULL);
}
}

static int do_pri_br(aufs_bindex_t bindex, struct au_branch *br)
Expand Down Expand Up @@ -367,20 +372,6 @@ void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen)
au_dpages_free(&dpages);
}

void au_dbg_verify_hf(struct au_finfo *finfo)
{
struct au_hfile *hf;
aufs_bindex_t bend, bindex;

if (finfo->fi_bstart >= 0) {
bend = finfo->fi_bend;
for (bindex = finfo->fi_bstart; bindex <= bend; bindex++) {
hf = finfo->fi_hfile + bindex;
AuDebugOn(hf->hf_file || hf->hf_br);
}
}
}

void au_dbg_verify_kthread(void)
{
if (au_test_wkq(current)) {
Expand Down
2 changes: 0 additions & 2 deletions fs/aufs/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void au_dbg_iattr(struct iattr *ia);
void au_dbg_verify_dir_parent(struct dentry *dentry, unsigned int sigen);
void au_dbg_verify_nondir_parent(struct dentry *dentry, unsigned int sigen);
void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen);
void au_dbg_verify_hf(struct au_finfo *finfo);
void au_dbg_verify_kthread(void);

int __init au_debug_init(void);
Expand Down Expand Up @@ -200,7 +199,6 @@ AuStubVoid(au_dbg_verify_dir_parent, struct dentry *dentry, unsigned int sigen)
AuStubVoid(au_dbg_verify_nondir_parent, struct dentry *dentry,
unsigned int sigen)
AuStubVoid(au_dbg_verify_gen, struct dentry *parent, unsigned int sigen)
AuStubVoid(au_dbg_verify_hf, struct au_finfo *finfo)
AuStubVoid(au_dbg_verify_kthread, void)
AuStubInt0(__init au_debug_init, void)
AuStubVoid(au_debug_sbinfo_init, struct au_sbinfo *sbinfo)
Expand Down
89 changes: 73 additions & 16 deletions fs/aufs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ loff_t au_dir_size(struct file *file, struct dentry *dentry)
AuDebugOn(!file->f_dentry->d_inode);
AuDebugOn(!S_ISDIR(file->f_dentry->d_inode->i_mode));

bend = au_fbend(file);
bend = au_fbend_dir(file);
for (bindex = au_fbstart(file);
bindex <= bend && sz < KMALLOC_MAX_SIZE;
bindex++) {
h_file = au_h_fptr(file, bindex);
h_file = au_hf_dir(file, bindex);
if (h_file
&& h_file->f_dentry
&& h_file->f_dentry->d_inode)
Expand Down Expand Up @@ -108,16 +108,16 @@ static int reopen_dir(struct file *file)
au_set_fbstart(file, bstart);

btail = au_dbtaildir(dentry);
for (bindex = au_fbend(file); btail < bindex; bindex--)
for (bindex = au_fbend_dir(file); btail < bindex; bindex--)
au_set_h_fptr(file, bindex, NULL);
au_set_fbend(file, btail);
au_set_fbend_dir(file, btail);

flags = vfsub_file_flags(file);
for (bindex = bstart; bindex <= btail; bindex++) {
h_dentry = au_h_dptr(dentry, bindex);
if (!h_dentry)
continue;
h_file = au_h_fptr(file, bindex);
h_file = au_hf_dir(file, bindex);
if (h_file)
continue;

Expand Down Expand Up @@ -147,12 +147,11 @@ static int do_open_dir(struct file *file, int flags)

err = 0;
dentry = file->f_dentry;
au_set_fvdir_cache(file, NULL);
file->f_version = dentry->d_inode->i_version;
bindex = au_dbstart(dentry);
au_set_fbstart(file, bindex);
btail = au_dbtaildir(dentry);
au_set_fbend(file, btail);
au_set_fbend_dir(file, btail);
for (; !err && bindex <= btail; bindex++) {
h_dentry = au_h_dptr(dentry, bindex);
if (!h_dentry)
Expand All @@ -175,33 +174,91 @@ static int do_open_dir(struct file *file, int flags)
for (bindex = au_fbstart(file); bindex <= btail; bindex++)
au_set_h_fptr(file, bindex, NULL);
au_set_fbstart(file, -1);
au_set_fbend(file, -1);
au_set_fbend_dir(file, -1);

return err;
}

static int aufs_open_dir(struct inode *inode __maybe_unused,
struct file *file)
{
return au_do_open(file, do_open_dir);
int err;
struct super_block *sb;
struct au_fidir *fidir;

err = -ENOMEM;
sb = file->f_dentry->d_sb;
si_read_lock(sb, AuLock_FLUSH);
fidir = au_fidir_alloc(inode->i_sb);
if (fidir) {
err = au_do_open(file, do_open_dir, fidir);
if (unlikely(err))
kfree(fidir);
}
si_read_unlock(sb);
return err;
}

static int aufs_release_dir(struct inode *inode __maybe_unused,
struct file *file)
{
struct au_vdir *vdir_cache;
struct super_block *sb;
struct au_finfo *finfo;
struct au_fidir *fidir;
aufs_bindex_t bindex, bend;

sb = file->f_dentry->d_sb;
vdir_cache = au_fi(file)->fi_vdir_cache; /* lock-free */
if (vdir_cache)
au_vdir_free(vdir_cache);
au_plink_maint_leave(file);
sb = file->f_dentry->d_sb;
finfo = au_fi(file);
fidir = finfo->fi_hdir;
if (fidir) {
vdir_cache = fidir->fd_vdir_cache; /* lock-free */
if (vdir_cache)
au_vdir_free(vdir_cache);

bindex = finfo->fi_btop;
if (bindex >= 0) {
/*
* calls fput() instead of filp_close(),
* since no dnotify or lock for the lower file.
*/
bend = fidir->fd_bbot;
for (; bindex <= bend; bindex++)
au_set_h_fptr(file, bindex, NULL);
}
kfree(fidir);
finfo->fi_hdir = NULL;
}
au_finfo_fin(file);
return 0;
}

/* ---------------------------------------------------------------------- */

static int au_do_flush_dir(struct file *file, fl_owner_t id)
{
int err;
aufs_bindex_t bindex, bend;
struct file *h_file;

err = 0;
bend = au_fbend_dir(file);
for (bindex = au_fbstart(file); !err && bindex <= bend; bindex++) {
h_file = au_hf_dir(file, bindex);
if (h_file)
err = vfsub_flush(h_file, id);
}
return err;
}

static int aufs_flush_dir(struct file *file, fl_owner_t id)
{
return au_do_flush(file, id, au_do_flush_dir);
}

/* ---------------------------------------------------------------------- */

static int au_do_fsync_dir_no_file(struct dentry *dentry, int datasync)
{
int err;
Expand Down Expand Up @@ -262,9 +319,9 @@ static int au_do_fsync_dir(struct file *file, int datasync)

sb = file->f_dentry->d_sb;
inode = file->f_dentry->d_inode;
bend = au_fbend(file);
bend = au_fbend_dir(file);
for (bindex = au_fbstart(file); !err && bindex <= bend; bindex++) {
h_file = au_h_fptr(file, bindex);
h_file = au_hf_dir(file, bindex);
if (!h_file || au_test_ro(sb, bindex, inode))
continue;

Expand Down Expand Up @@ -575,6 +632,6 @@ const struct file_operations aufs_dir_fop = {
.unlocked_ioctl = aufs_ioctl_dir,
.open = aufs_open_dir,
.release = aufs_release_dir,
.flush = aufs_flush,
.flush = aufs_flush_dir,
.fsync = aufs_fsync_dir
};
Loading

0 comments on commit 5dc4cd3

Please sign in to comment.