Commit b174eb1b authored by J. R. Okajima's avatar J. R. Okajima
Browse files

Merge branch 'aufs5.x-rcN/00base' into aufs5.x-rcN/01modular

parents 56f34c73 70f8bb83
...@@ -228,10 +228,8 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, ...@@ -228,10 +228,8 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
ino_t *ino); ino_t *ino);
int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
ino_t ino); ino_t ino);
ssize_t xino_fread(vfs_readf_t func, struct file *file, void *buf, size_t size, ssize_t xino_fread(struct file *file, void *buf, size_t size, loff_t *pos);
loff_t *pos); ssize_t xino_fwrite(struct file *file, void *buf, size_t size, loff_t *pos);
ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
size_t size, loff_t *pos);
int au_xib_trunc(struct super_block *sb); int au_xib_trunc(struct super_block *sb);
int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex, int idx_begin); int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex, int idx_begin);
......
...@@ -556,32 +556,19 @@ out: ...@@ -556,32 +556,19 @@ out:
static int au_do_cpup_symlink(struct path *h_path, struct dentry *h_src, static int au_do_cpup_symlink(struct path *h_path, struct dentry *h_src,
struct inode *h_dir) struct inode *h_dir)
{ {
int err, symlen; int err;
mm_segment_t old_fs; DEFINE_DELAYED_CALL(done);
union { const char *sym;
char *k;
char __user *u;
} sym;
err = -ENOMEM; sym = vfs_get_link(h_src, &done);
sym.k = (void *)__get_free_page(GFP_NOFS); err = PTR_ERR(sym);
if (unlikely(!sym.k)) if (IS_ERR(sym))
goto out; goto out;
/* unnecessary to support mmap_sem since symlink is not mmap-able */ err = vfsub_symlink(h_dir, h_path, sym);
old_fs = get_fs();
set_fs(KERNEL_DS);
symlen = vfs_readlink(h_src, sym.u, PATH_MAX);
err = symlen;
set_fs(old_fs);
if (symlen > 0) {
sym.k[symlen] = 0;
err = vfsub_symlink(h_dir, h_path, sym.k);
}
free_page((unsigned long)sym.k);
out: out:
do_delayed_call(&done);
return err; return err;
} }
......
...@@ -108,8 +108,7 @@ void au_xigen_inc(struct inode *inode) ...@@ -108,8 +108,7 @@ void au_xigen_inc(struct inode *inode)
pos = inode->i_ino; pos = inode->i_ino;
pos *= sizeof(igen); pos *= sizeof(igen);
igen = inode->i_generation + 1; igen = inode->i_generation + 1;
sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xigen, &igen, sz = xino_fwrite(sbinfo->si_xigen, &igen, sizeof(igen), &pos);
sizeof(igen), &pos);
if (sz == sizeof(igen)) if (sz == sizeof(igen))
return; /* success */ return; /* success */
...@@ -151,10 +150,10 @@ int au_xigen_new(struct inode *inode) ...@@ -151,10 +150,10 @@ int au_xigen_new(struct inode *inode)
if (vfsub_f_size_read(file) if (vfsub_f_size_read(file)
< pos + sizeof(inode->i_generation)) { < pos + sizeof(inode->i_generation)) {
inode->i_generation = atomic_inc_return(&sbinfo->si_xigen_next); inode->i_generation = atomic_inc_return(&sbinfo->si_xigen_next);
sz = xino_fwrite(sbinfo->si_xwrite, file, &inode->i_generation, sz = xino_fwrite(file, &inode->i_generation,
sizeof(inode->i_generation), &pos); sizeof(inode->i_generation), &pos);
} else } else
sz = xino_fread(sbinfo->si_xread, file, &inode->i_generation, sz = xino_fread(file, &inode->i_generation,
sizeof(inode->i_generation), &pos); sizeof(inode->i_generation), &pos);
if (sz == sizeof(inode->i_generation)) if (sz == sizeof(inode->i_generation))
goto out; /* success */ goto out; /* success */
......
...@@ -229,34 +229,6 @@ static void au_write_post(struct inode *inode, struct file *h_file, ...@@ -229,34 +229,6 @@ static void au_write_post(struct inode *inode, struct file *h_file,
fput(h_file); fput(h_file);
} }
static ssize_t aufs_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
ssize_t err;
struct inode *inode;
struct file *h_file;
struct super_block *sb;
inode = file_inode(file);
sb = inode->i_sb;
si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
err = PTR_ERR(h_file);
if (IS_ERR(h_file))
goto out;
/* filedata may be obsoleted by concurrent copyup, but no problem */
err = vfsub_read_u(h_file, buf, count, ppos);
/* todo: necessary? */
/* file->f_ra = h_file->f_ra; */
au_read_post(inode, h_file);
out:
si_read_unlock(sb);
return err;
}
/* /*
* todo: very ugly * todo: very ugly
* it locks both of i_mutex and si_rwsem for read in safe. * it locks both of i_mutex and si_rwsem for read in safe.
...@@ -279,33 +251,6 @@ static void au_mtx_and_read_lock(struct inode *inode) ...@@ -279,33 +251,6 @@ static void au_mtx_and_read_lock(struct inode *inode)
} }
} }
static ssize_t aufs_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos)
{
ssize_t err;
struct au_write_pre wpre;
struct inode *inode;
struct file *h_file;
char __user *buf = (char __user *)ubuf;
inode = file_inode(file);
au_mtx_and_read_lock(inode);
wpre.lsc = 0;
h_file = au_write_pre(file, /*do_ready*/1, &wpre);
err = PTR_ERR(h_file);
if (IS_ERR(h_file))
goto out;
err = vfsub_write_u(h_file, buf, count, ppos);
au_write_post(inode, h_file, &wpre, err);
out:
si_read_unlock(inode->i_sb);
inode_unlock(inode);
return err;
}
static ssize_t au_do_iter(struct file *h_file, int rw, struct kiocb *kio, static ssize_t au_do_iter(struct file *h_file, int rw, struct kiocb *kio,
struct iov_iter *iov_iter) struct iov_iter *iov_iter)
{ {
...@@ -775,8 +720,6 @@ const struct file_operations aufs_file_fop = { ...@@ -775,8 +720,6 @@ const struct file_operations aufs_file_fop = {
.llseek = default_llseek, .llseek = default_llseek,
.read = aufs_read,
.write = aufs_write,
.read_iter = aufs_read_iter, .read_iter = aufs_read_iter,
.write_iter = aufs_write_iter, .write_iter = aufs_write_iter,
......
...@@ -118,8 +118,6 @@ struct au_sbinfo { ...@@ -118,8 +118,6 @@ struct au_sbinfo {
unsigned int si_mntflags; unsigned int si_mntflags;
/* external inode number (bitmap and translation table) */ /* external inode number (bitmap and translation table) */
vfs_readf_t si_xread;
vfs_writef_t si_xwrite;
loff_t si_ximaxent; /* max entries in a xino */ loff_t si_ximaxent; /* max entries in a xino */
struct file *si_xib; struct file *si_xib;
......
...@@ -500,22 +500,17 @@ ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count, ...@@ -500,22 +500,17 @@ ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count,
return err; return err;
} }
/* todo: kernel_read()? */
ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count, ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
ssize_t err; ssize_t err;
mm_segment_t oldfs;
union { lockdep_off();
void *k; err = kernel_read(file, kbuf, count, ppos);
char __user *u; lockdep_on();
} buf; AuTraceErr(err);
if (err >= 0)
buf.k = kbuf; vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/
oldfs = get_fs();
set_fs(KERNEL_DS);
err = vfsub_read_u(file, buf.u, count, ppos);
set_fs(oldfs);
return err; return err;
} }
...@@ -535,17 +530,12 @@ ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count, ...@@ -535,17 +530,12 @@ ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count,
ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count, loff_t *ppos) ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count, loff_t *ppos)
{ {
ssize_t err; ssize_t err;
mm_segment_t oldfs;
union { lockdep_off();
void *k; err = kernel_write(file, kbuf, count, ppos);
const char __user *u; lockdep_on();
} buf; if (err >= 0)
vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/
buf.k = kbuf;
oldfs = get_fs();
set_fs(KERNEL_DS);
err = vfsub_write_u(file, buf.u, count, ppos);
set_fs(oldfs);
return err; return err;
} }
......
...@@ -647,8 +647,8 @@ struct au_xi_writing { ...@@ -647,8 +647,8 @@ struct au_xi_writing {
ino_t h_ino, ino; ino_t h_ino, ino;
}; };
static int au_xino_do_write(vfs_writef_t write, struct file *file, static int au_xino_do_write(struct file *file, struct au_xi_calc *calc,
struct au_xi_calc *calc, ino_t ino); ino_t ino);
static void au_xino_call_do_new_async(void *args) static void au_xino_call_do_new_async(void *args)
{ {
...@@ -677,7 +677,7 @@ static void au_xino_call_do_new_async(void *args) ...@@ -677,7 +677,7 @@ static void au_xino_call_do_new_async(void *args)
file = au_xino_file(br->br_xino, a->calc.idx); file = au_xino_file(br->br_xino, a->calc.idx);
AuDebugOn(!file); AuDebugOn(!file);
err = au_xino_do_write(sbi->si_xwrite, file, &a->calc, a->ino); err = au_xino_do_write(file, &a->calc, a->ino);
if (unlikely(err)) { if (unlikely(err)) {
AuIOErr("err %d\n", err); AuIOErr("err %d\n", err);
goto out; goto out;
...@@ -778,7 +778,7 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, ...@@ -778,7 +778,7 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
return 0; /* no xino */ return 0; /* no xino */
sbinfo = au_sbi(sb); sbinfo = au_sbi(sb);
sz = xino_fread(sbinfo->si_xread, file, ino, sizeof(*ino), &calc.pos); sz = xino_fread(file, ino, sizeof(*ino), &calc.pos);
if (sz == sizeof(*ino)) if (sz == sizeof(*ino))
return 0; /* success */ return 0; /* success */
...@@ -790,12 +790,12 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, ...@@ -790,12 +790,12 @@ int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
return err; return err;
} }
static int au_xino_do_write(vfs_writef_t write, struct file *file, static int au_xino_do_write(struct file *file, struct au_xi_calc *calc,
struct au_xi_calc *calc, ino_t ino) ino_t ino)
{ {
ssize_t sz; ssize_t sz;
sz = xino_fwrite(write, file, &ino, sizeof(ino), &calc->pos); sz = xino_fwrite(file, &ino, sizeof(ino), &calc->pos);
if (sz == sizeof(ino)) if (sz == sizeof(ino))
return 0; /* success */ return 0; /* success */
...@@ -845,7 +845,7 @@ int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, ...@@ -845,7 +845,7 @@ int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
goto out; goto out;
} }
err = au_xino_do_write(au_sbi(sb)->si_xwrite, file, &calc, ino); err = au_xino_do_write(file, &calc, ino);
if (!err) { if (!err) {
br = au_sbr(sb, bindex); br = au_sbr(sb, bindex);
if (au_opt_test(mnt_flags, TRUNC_XINO) if (au_opt_test(mnt_flags, TRUNC_XINO)
...@@ -859,40 +859,27 @@ out: ...@@ -859,40 +859,27 @@ out:
return -EIO; return -EIO;
} }
static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf, static ssize_t xino_fread_wkq(struct file *file, void *buf, size_t size,
size_t size, loff_t *pos); loff_t *pos);
/* todo: unnecessary to support mmap_sem since kernel-space? */ /* todo: unnecessary to support mmap_sem since kernel-space? */
ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size, ssize_t xino_fread(struct file *file, void *kbuf, size_t size, loff_t *pos)
loff_t *pos)
{ {
ssize_t err; ssize_t err;
mm_segment_t oldfs;
union {
void *k;
char __user *u;
} buf;
int i; int i;
const int prevent_endless = 10; const int prevent_endless = 10;
i = 0; i = 0;
buf.k = kbuf;
oldfs = get_fs();
set_fs(KERNEL_DS);
do { do {
err = func(file, buf.u, size, pos); err = vfsub_read_k(file, kbuf, size, pos);
if (err == -EINTR if (err == -EINTR
&& !au_wkq_test() && !au_wkq_test()
&& fatal_signal_pending(current)) { && fatal_signal_pending(current)) {
set_fs(oldfs); err = xino_fread_wkq(file, kbuf, size, pos);
err = xino_fread_wkq(func, file, kbuf, size, pos);
BUG_ON(err == -EINTR); BUG_ON(err == -EINTR);
oldfs = get_fs();
set_fs(KERNEL_DS);
} }
} while (i++ < prevent_endless } while (i++ < prevent_endless
&& (err == -EAGAIN || err == -EINTR)); && (err == -EAGAIN || err == -EINTR));
set_fs(oldfs);
#if 0 /* reserved for future use */ #if 0 /* reserved for future use */
if (err > 0) if (err > 0)
...@@ -904,7 +891,6 @@ ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size, ...@@ -904,7 +891,6 @@ ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size,
struct xino_fread_args { struct xino_fread_args {
ssize_t *errp; ssize_t *errp;
vfs_readf_t func;
struct file *file; struct file *file;
void *buf; void *buf;
size_t size; size_t size;
...@@ -914,17 +900,16 @@ struct xino_fread_args { ...@@ -914,17 +900,16 @@ struct xino_fread_args {
static void call_xino_fread(void *args) static void call_xino_fread(void *args)
{ {
struct xino_fread_args *a = args; struct xino_fread_args *a = args;
*a->errp = xino_fread(a->func, a->file, a->buf, a->size, a->pos); *a->errp = xino_fread(a->file, a->buf, a->size, a->pos);
} }
static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf, static ssize_t xino_fread_wkq(struct file *file, void *buf, size_t size,
size_t size, loff_t *pos) loff_t *pos)
{ {
ssize_t err; ssize_t err;
int wkq_err; int wkq_err;
struct xino_fread_args args = { struct xino_fread_args args = {
.errp = &err, .errp = &err,
.func = func,
.file = file, .file = file,
.buf = buf, .buf = buf,
.size = size, .size = size,
...@@ -938,39 +923,27 @@ static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf, ...@@ -938,39 +923,27 @@ static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
return err; return err;
} }
static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf, static ssize_t xino_fwrite_wkq(struct file *file, void *buf, size_t size,
size_t size, loff_t *pos); loff_t *pos);
static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf, static ssize_t do_xino_fwrite(struct file *file, void *kbuf, size_t size,
size_t size, loff_t *pos) loff_t *pos)
{ {
ssize_t err; ssize_t err;
mm_segment_t oldfs;
union {
void *k;
const char __user *u;
} buf;
int i; int i;
const int prevent_endless = 10; const int prevent_endless = 10;
i = 0; i = 0;
buf.k = kbuf;
oldfs = get_fs();
set_fs(KERNEL_DS);
do { do {
err = func(file, buf.u, size, pos); err = vfsub_write_k(file, kbuf, size, pos);
if (err == -EINTR if (err == -EINTR
&& !au_wkq_test() && !au_wkq_test()
&& fatal_signal_pending(current)) { && fatal_signal_pending(current)) {
set_fs(oldfs); err = xino_fwrite_wkq(file, kbuf, size, pos);
err = xino_fwrite_wkq(func, file, kbuf, size, pos);
BUG_ON(err == -EINTR); BUG_ON(err == -EINTR);
oldfs = get_fs();
set_fs(KERNEL_DS);
} }
} while (i++ < prevent_endless } while (i++ < prevent_endless
&& (err == -EAGAIN || err == -EINTR)); && (err == -EAGAIN || err == -EINTR));
set_fs(oldfs);
#if 0 /* reserved for future use */ #if 0 /* reserved for future use */
if (err > 0) if (err > 0)
...@@ -982,7 +955,6 @@ static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf, ...@@ -982,7 +955,6 @@ static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf,
struct do_xino_fwrite_args { struct do_xino_fwrite_args {
ssize_t *errp; ssize_t *errp;
vfs_writef_t func;
struct file *file; struct file *file;
void *buf; void *buf;
size_t size; size_t size;
...@@ -992,17 +964,16 @@ struct do_xino_fwrite_args { ...@@ -992,17 +964,16 @@ struct do_xino_fwrite_args {
static void call_do_xino_fwrite(void *args) static void call_do_xino_fwrite(void *args)
{ {
struct do_xino_fwrite_args *a = args; struct do_xino_fwrite_args *a = args;
*a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos); *a->errp = do_xino_fwrite(a->file, a->buf, a->size, a->pos);
} }
static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf, static ssize_t xino_fwrite_wkq(struct file *file, void *buf, size_t size,
size_t size, loff_t *pos) loff_t *pos)
{ {
ssize_t err; ssize_t err;
int wkq_err; int wkq_err;
struct do_xino_fwrite_args args = { struct do_xino_fwrite_args args = {
.errp = &err, .errp = &err,
.func = func,
.file = file, .file = file,
.buf = buf, .buf = buf,
.size = size, .size = size,
...@@ -1020,18 +991,17 @@ static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf, ...@@ -1020,18 +991,17 @@ static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
return err; return err;
} }
ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf, ssize_t xino_fwrite(struct file *file, void *buf, size_t size, loff_t *pos)
size_t size, loff_t *pos)
{ {
ssize_t err; ssize_t err;
if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) { if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) {
lockdep_off(); lockdep_off();
err = do_xino_fwrite(func, file, buf, size, pos); err = do_xino_fwrite(file, buf, size, pos);
lockdep_on(); lockdep_on();
} else { } else {
lockdep_off(); lockdep_off();
err = xino_fwrite_wkq(func, file, buf, size, pos); err = xino_fwrite_wkq(file, buf, size, pos);
lockdep_on(); lockdep_on();
} }
...@@ -1082,17 +1052,17 @@ static int xib_pindex(struct super_block *sb, unsigned long pindex) ...@@ -1082,17 +1052,17 @@ static int xib_pindex(struct super_block *sb, unsigned long pindex)
p = sbinfo->si_xib_buf; p = sbinfo->si_xib_buf;
pos = sbinfo->si_xib_last_pindex; pos = sbinfo->si_xib_last_pindex;
pos *= PAGE_SIZE; pos *= PAGE_SIZE;
sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos); sz = xino_fwrite(xib, p, PAGE_SIZE, &pos);
if (unlikely(sz != PAGE_SIZE)) if (unlikely(sz != PAGE_SIZE))
goto out; goto out;
pos = pindex; pos = pindex;
pos *= PAGE_SIZE; pos *= PAGE_SIZE;
if (vfsub_f_size_read(xib) >= pos + PAGE_SIZE) if (vfsub_f_size_read(xib) >= pos + PAGE_SIZE)
sz = xino_fread(sbinfo->si_xread, xib, p, PAGE_SIZE, &pos); sz = xino_fread(xib, p, PAGE_SIZE, &pos);
else { else {
memset(p, 0, PAGE_SIZE); memset(p, 0, PAGE_SIZE);
sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos); sz = xino_fwrite(xib, p, PAGE_SIZE, &pos);
} }
if (sz == PAGE_SIZE) { if (sz == PAGE_SIZE) {
sbinfo->si_xib_last_pindex = pindex; sbinfo->si_xib_last_pindex = pindex;
...@@ -1143,7 +1113,6 @@ static int do_xib_restore(struct super_block *sb, struct file *file, void *page) ...@@ -1143,7 +1113,6 @@ static int do_xib_restore(struct super_block *sb, struct file *file, void *page)
unsigned long pindex; unsigned long pindex;
loff_t pos, pend; loff_t pos, pend;
struct au_sbinfo *sbinfo; struct au_sbinfo *sbinfo;
vfs_readf_t func;
ino_t *ino; ino_t *ino;
unsigned long *p; unsigned long *p;
...@@ -1151,11 +1120,10 @@ static int do_xib_restore(struct super_block *sb, struct file *file, void *page) ...@@ -1151,11 +1120,10 @@ static int do_xib_restore(struct super_block *sb, struct file *file, void *page)
sbinfo = au_sbi(sb); sbinfo = au_sbi(sb);
MtxMustLock(&sbinfo->si_xib_mtx); MtxMustLock(&sbinfo->si_xib_mtx);
p = sbinfo->si_xib_buf; p = sbinfo->si_xib_buf;
func = sbinfo->si_xread;
pend = vfsub_f_size_read(file); pend = vfsub_f_size_read(file);
pos = 0; pos = 0;
while (pos < pend) { while (pos < pend) {
sz = xino_fread(func, file, page, PAGE_SIZE, &pos); sz = xino_fread(file, page, PAGE_SIZE, &pos);
err = sz; err = sz;
if (unlikely(sz <= 0)) if (unlikely(sz <= 0))
goto out; goto out;
...@@ -1244,7 +1212,7 @@ int au_xib_trunc(struct super_block *sb) ...@@ -1244,7 +1212,7 @@ int au_xib_trunc(struct super_block *sb)
p = sbinfo->si_xib_buf; p = sbinfo->si_xib_buf;
memset(p, 0, PAGE_SIZE); memset(p, 0, PAGE_SIZE);
pos = 0; pos = 0;
sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xib, p, PAGE_SIZE, &pos); sz = xino_fwrite(sbinfo->si_xib, p, PAGE_SIZE, &pos);
if (unlikely(sz != PAGE_SIZE)) { if (unlikely(sz != PAGE_SIZE)) {
err = sz; err = sz;
AuIOErr("err %d\n", err); AuIOErr("err %d\n", err);
...@@ -1383,7 +1351,6 @@ static void xino_clear_xib(struct super_block *sb) ...@@ -1383,7 +1351,6 @@ static void xino_clear_xib(struct super_block *sb)
SiMustWriteLock(sb); SiMustWriteLock(sb);
sbinfo = au_sbi(sb); sbinfo = au_sbi(sb);
/* unnecessary to clear sbinfo->si_xread and ->si_xwrite */
if (sbinfo->si_xib) if (sbinfo->si_xib)
fput(sbinfo->si_xib); fput(sbinfo->si_xib);
sbinfo->si_xib = NULL; sbinfo->si_xib = NULL;
...@@ -1410,8 +1377,6 @@ static int au_xino_set_xib(struct super_block *sb, struct path *path) ...@@ -1410,8 +1377,6 @@ static int au_xino_set_xib(struct super_block *sb, struct path *path)
if (sbinfo->si_xib) if (sbinfo->si_xib)
fput(sbinfo->si_xib); fput(sbinfo->si_xib);
sbinfo->si_xib = file; sbinfo->si_xib = file;
sbinfo->si_xread = vfs_readf(file);
sbinfo->si_xwrite = vfs_writef(file);
xi_sb = file_inode(file)->i_sb; xi_sb = file_inode(file)->i_sb;
sbinfo->si_ximaxent = xi_sb->s_maxbytes; sbinfo->si_ximaxent = xi_sb->s_maxbytes;
if (unlikely(sbinfo->si_ximaxent < PAGE_SIZE)) { if (unlikely(sbinfo->si_ximaxent < PAGE_SIZE)) {
...@@ -1432,8 +1397,7 @@ static int au_xino_set_xib(struct super_block *sb, struct path *path) ...@@ -1432,8 +1397,7 @@ static int au_xino_set_xib(struct super_block *sb, struct path *path)
sbinfo->si_xib_next_bit = 0; sbinfo->si_xib_next_bit = 0;
if (vfsub_f_size_read(file) < PAGE_SIZE) { if (vfsub_f_size_read(file) < PAGE_SIZE) {
pos = 0; pos = 0;
err = xino_fwrite(sbinfo->si_xwrite, file, sbinfo->si_xib_buf, err = xino_fwrite(file, sbinfo->si_xib_buf, PAGE_SIZE, &pos);
PAGE_SIZE, &pos);
if (unlikely(err != PAGE_SIZE)) if (unlikely(err != PAGE_SIZE))
goto out_free; goto out_free;
} }
...@@ -1484,7 +1448,6 @@ static void au_xino_set_br_shared(struct super_block *sb, struct au_branch *br, ...@@ -1484,7 +1448,6 @@ static void au_xino_set_br_shared(struct super_block *sb, struct au_branch *br,
} }
struct au_xino_do_set_br { struct au_xino_do_set_br {
vfs_writef_t writef;
struct au_branch *br; struct au_branch *br;
ino_t h_ino; ino_t h_ino;
aufs_bindex_t bshared; aufs_bindex_t bshared;
...@@ -1526,7 +1489,7 @@ static int au_xino_do_set_br(struct super_block *sb, struct path *path, ...@@ -1526,7 +1489,7 @@ static int au_xino_do_set_br(struct super_block *sb, struct path *path,
goto out; goto out;
AuDebugOn(!file); AuDebugOn(!file);
err = au_xino_do_write(args->writef, file, &calc, AUFS_ROOT_INO); err = au_xino_do_write(file, &calc, AUFS_ROOT_INO);
if (unlikely(err)) if (unlikely(err))
au_xino_put(br); au_xino_put(br);
...@@ -1546,7 +1509,6 @@ static int au_xino_set_br(struct super_block *sb, struct path *path) ...@@ -1546,7 +1509,6 @@ static int au_xino_set_br(struct super_block *sb, struct path *path)
bbot = au_sbbot(sb); bbot = au_sbbot(sb);
inode = d_inode(sb->s_root); inode = d_inode(sb->s_root);
args.writef = au_sbi(sb)->si_xwrite;
for (bindex = 0; bindex <= bbot; bindex++) { for (bindex = 0; bindex <= bbot; bindex++) {
args.h_ino = au_h_iptr(inode, bindex)->i_ino; args.h_ino = au_h_iptr(inode, bindex)->i_ino;
args.br = au_sbr(sb, bindex); args.br = au_sbr(sb, bindex);
...@@ -1701,7 +1663,6 @@ int au_xino_init_br(struct super_block *sb, struct au_branch *br, ino_t h_ino, ...@@ -1701,7 +1663,6 @@ int au_xino_init_br(struct super_block *sb, struct au_branch *br, ino_t h_ino,
.br = br .br = br
}; };
args.writef = au_sbi(sb)->si_xwrite;
args.bshared = sbr_find_shared(sb, /*btop*/0, au_sbbot(sb), args.bshared = sbr_find_shared(sb, /*btop*/0, au_sbbot(sb),
au_br_sb(br)); au_br_sb(br));
err = au_xino_do_set_br(sb, base, &args); err = au_xino_do_set_br(sb, base, &args);
...@@ -1785,7 +1746,6 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked) ...@@ -1785,7 +1746,6 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked)
struct au_hinode *hi; struct au_hinode *hi;
struct inode *h_inode; struct inode *h_inode;
struct au_branch *br; struct au_branch *br;
vfs_writef_t xwrite;
struct au_xi_calc calc; struct au_xi_calc calc;
struct file *file; struct file *file;
...@@ -1807,7 +1767,6 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked) ...@@ -1807,7 +1767,6 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked)
if (bindex < 0) if (bindex < 0)
return; return;
xwrite = au_sbi(sb)->si_xwrite;
try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO); try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO);
hi = au_hinode(iinfo, bindex); hi = au_hinode(iinfo, bindex);
bbot = iinfo->ii_bbot; bbot = iinfo->ii_bbot;
...@@ -1828,7 +1787,7 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked) ...@@ -1828,7 +1787,7 @@ void au_xino_delete_inode(struct inode *inode, const int unlinked)
if (IS_ERR_OR_NULL(file)) if (IS_ERR_OR_NULL(file))
continue; continue;
err = au_xino_do_write(xwrite, file, &calc, /*ino*/0); err = au_xino_do_write(file, &calc, /*ino*/0);
if (!err && try_trunc if (!err && try_trunc
&& au_test_fs_trunc_xino(au_br_sb(br))) && au_test_fs_trunc_xino(au_br_sb(br)))
xino_try_trunc(sb, br); xino_try_trunc(sb, br);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment