Hello Vasily, Vasily Tarasov: > Hello, I've just compiled aufs on my 64bit node and there were a lot of > warnings caused by 64bit specifics. The tiny patch below fixes most of them. > However there are still a bit warnings, but it depends greatly on the author > how to fix it, so I just report about them:
Thank you. Won't you try this patch? - apply cast operator to size_t and ssize_t. - refine inline au_is_mmapped(). - rename static fread() and fwrite(). - refine vfsub_read/write() which is unrelated to this issue. Junjiro Okajima ---------------------------------------------------------------------- Index: fs/aufs/debug.h =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/debug.h,v retrieving revision 1.25 diff -u -p -r1.25 debug.h --- fs/aufs/debug.h 27 Mar 2007 12:45:59 -0000 1.25 +++ fs/aufs/debug.h 3 Apr 2007 04:00:02 -0000 @@ -60,7 +60,7 @@ extern atomic_t aufs_cond; }while(0) #define TraceErrPtr(p) do { \ if (IS_ERR(p)) \ - TraceErr(PTR_ERR(p)); \ + LKTRTrace("err %ld\n", PTR_ERR(p)); \ }while(0) #define TraceEnter() LKTRLabel(enter) Index: fs/aufs/f_op.c =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/f_op.c,v retrieving revision 1.21 diff -u -p -r1.21 f_op.c --- fs/aufs/f_op.c 27 Mar 2007 12:49:00 -0000 1.21 +++ fs/aufs/f_op.c 3 Apr 2007 04:00:02 -0000 @@ -130,7 +130,8 @@ static ssize_t aufs_read(struct file *fi int dlgt; dentry = file->f_dentry; - LKTRTrace("%.*s, cnt %d, pos %Ld\n", DLNPair(dentry), count, *ppos); + LKTRTrace("%.*s, cnt %lu, pos %Ld\n", + DLNPair(dentry), (unsigned long)count, *ppos); sb = dentry->d_sb; si_read_lock(sb); @@ -177,7 +178,8 @@ static ssize_t aufs_write(struct file *f int dlgt; dentry = file->f_dentry; - LKTRTrace("%.*s, cnt %d, pos %Ld\n", DLNPair(dentry), count, *ppos); + LKTRTrace("%.*s, cnt %lu, pos %Ld\n", + DLNPair(dentry), (unsigned long)count, *ppos); inode = dentry->d_inode; i_lock(inode); @@ -467,8 +469,8 @@ static ssize_t aufs_sendfile(struct file struct super_block *sb; dentry = file->f_dentry; - LKTRTrace("%.*s, pos %Ld, cnt %d, loopback %d\n", - DLNPair(dentry), *ppos, count, loopback); + LKTRTrace("%.*s, pos %Ld, cnt %lu, loopback %d\n", + DLNPair(dentry), *ppos, (unsigned long)count, loopback); sb = dentry->d_sb; si_read_lock(sb); Index: fs/aufs/file.h =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/file.h,v retrieving revision 1.21 diff -u -p -r1.21 file.h --- fs/aufs/file.h 27 Mar 2007 12:46:34 -0000 1.21 +++ fs/aufs/file.h 3 Apr 2007 04:00:02 -0000 @@ -104,7 +104,7 @@ static inline int au_figen(struct file * static inline int au_is_mmapped(struct file *f) { - return (int)ftofi(f)->fi_h_vm_ops; + return !!ftofi(f)->fi_h_vm_ops; } /* ---------------------------------------------------------------------- */ Index: fs/aufs/sysaufs.c =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/sysaufs.c,v retrieving revision 1.1 diff -u -p -r1.1 sysaufs.c --- fs/aufs/sysaufs.c 27 Mar 2007 12:52:39 -0000 1.1 +++ fs/aufs/sysaufs.c 3 Apr 2007 04:00:02 -0000 @@ -374,7 +374,7 @@ static ssize_t sysaufs_read(struct kobje loff_t len; struct dentry *d; - LKTRTrace("%d, offset %Ld, sz %u\n", index, offset, sz); + LKTRTrace("%d, offset %Ld, sz %lu\n", index, offset, (unsigned long)sz); if (unlikely(!sz)) return 0; Index: fs/aufs/vfsub.c =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/vfsub.c,v retrieving revision 1.3 diff -u -p -r1.3 vfsub.c --- fs/aufs/vfsub.c 2 Apr 2007 01:19:29 -0000 1.3 +++ fs/aufs/vfsub.c 3 Apr 2007 04:00:02 -0000 @@ -294,17 +294,15 @@ struct read_args { static void call_read_k(void *args) { struct read_args *a = args; - LKTRTrace("%.*s, cnt %u, pos %Ld\n", - DLNPair(a->file->f_dentry), a->count, *a->ppos); + LKTRTrace("%.*s, cnt %lu, pos %Ld\n", + DLNPair(a->file->f_dentry), (unsigned long)a->count, + *a->ppos); *a->errp = do_vfsub_read_k(a->file, a->kbuf, a->count, a->ppos); } ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count, loff_t *ppos, int dlgt) { - if (unlikely(!count)) - return 0; - if (!dlgt) return do_vfsub_read_u(file, ubuf, count, ppos); else { @@ -316,12 +314,16 @@ ssize_t vfsub_read_u(struct file *file, .ppos = ppos }; + if (unlikely(!count)) + return 0; + /* * workaround an application bug. * generally, read(2) or write(2) may return the value shorter - * then requested. But many applications don't support it, + * than requested. But many applications don't support it, * for example bash. */ + err = -ENOMEM; if (args.count > PAGE_SIZE) args.count = PAGE_SIZE; args.kbuf = kmalloc(args.count, GFP_KERNEL); @@ -343,6 +345,7 @@ ssize_t vfsub_read_u(struct file *file, ubuf += err; read += err; } while (count); + smp_mb(); err = read; out_free: @@ -386,17 +389,15 @@ struct write_args { static void call_write_k(void *args) { struct write_args *a = args; - LKTRTrace("%.*s, cnt %u, pos %Ld\n", - DLNPair(a->file->f_dentry), a->count, *a->ppos); + LKTRTrace("%.*s, cnt %lu, pos %Ld\n", + DLNPair(a->file->f_dentry), (unsigned long)a->count, + *a->ppos); *a->errp = do_vfsub_write_k(a->file, a->kbuf, a->count, a->ppos); } ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos, int dlgt) { - if (unlikely(!count)) - return 0; - if (!dlgt) return do_vfsub_write_u(file, ubuf, count, ppos); else { @@ -408,14 +409,16 @@ ssize_t vfsub_write_u(struct file *file, .ppos = ppos }; - err = -ENOMEM; + if (unlikely(!count)) + return 0; /* * workaround an application bug. * generally, read(2) or write(2) may return the value shorter - * then requested. But many applications don't support it, + * than requested. But many applications don't support it, * for example bash. */ + err = -ENOMEM; if (args.count > PAGE_SIZE) args.count = PAGE_SIZE; args.kbuf = kmalloc(args.count, GFP_KERNEL); Index: fs/aufs/xino.c =================================================================== RCS file: /cvsroot/aufs/aufs/fs/aufs/xino.c,v retrieving revision 1.22 diff -u -p -r1.22 xino.c --- fs/aufs/xino.c 27 Mar 2007 12:51:44 -0000 1.22 +++ fs/aufs/xino.c 3 Apr 2007 04:00:02 -0000 @@ -49,14 +49,14 @@ static writef_t find_writef(struct file return ERR_PTR(-ENOSYS); } -static ssize_t fread(readf_t func, struct file *file, void *buf, size_t size, - loff_t *pos) +static ssize_t xino_fread(readf_t func, struct file *file, void *buf, + size_t size, loff_t *pos) { ssize_t err; mm_segment_t oldfs; - LKTRTrace("%.*s, sz %d, *pos %Ld\n", - DLNPair(file->f_dentry), size, *pos); + LKTRTrace("%.*s, sz %lu, *pos %Ld\n", + DLNPair(file->f_dentry), (unsigned long)size, *pos); oldfs = get_fs(); set_fs(KERNEL_DS); @@ -74,8 +74,8 @@ static ssize_t fread(readf_t func, struc return err; } -static ssize_t do_fwrite(writef_t func, struct file *file, void *buf, - size_t size, loff_t *pos) +static ssize_t do_xino_fwrite(writef_t func, struct file *file, void *buf, + size_t size, loff_t *pos) { ssize_t err; mm_segment_t oldfs; @@ -98,7 +98,7 @@ static ssize_t do_fwrite(writef_t func, return err; } -struct do_fwrite_args { +struct do_xino_fwrite_args { ssize_t *errp; writef_t func; struct file *file; @@ -107,19 +107,19 @@ struct do_fwrite_args { loff_t *pos; }; -static void call_do_fwrite(void *args) +static void call_do_xino_fwrite(void *args) { - struct do_fwrite_args *a = args; - *a->errp = do_fwrite(a->func, a->file, a->buf, a->size, a->pos); + struct do_xino_fwrite_args *a = args; + *a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos); } -static ssize_t fwrite(writef_t func, struct file *file, void *buf, size_t size, - loff_t *pos) +static ssize_t xino_fwrite(writef_t func, struct file *file, void *buf, + size_t size, loff_t *pos) { ssize_t err; - LKTRTrace("%.*s, sz %d, *pos %Ld\n", - DLNPair(file->f_dentry), size, *pos); + LKTRTrace("%.*s, sz %lu, *pos %Ld\n", + DLNPair(file->f_dentry), (unsigned long)size, *pos); // signal block and no wkq? /* @@ -127,7 +127,7 @@ static ssize_t fwrite(writef_t func, str * users should care about quota and real 'filesystem full.' */ if (!au_is_kthread(current)) { - struct do_fwrite_args args = { + struct do_xino_fwrite_args args = { .errp = &err, .func = func, .file = file, @@ -135,9 +135,9 @@ static ssize_t fwrite(writef_t func, str .size = size, .pos = pos }; - wkq_wait(call_do_fwrite, &args, /*dlgt*/0); + wkq_wait(call_do_xino_fwrite, &args, /*dlgt*/0); } else - err = do_fwrite(func, file, buf, size, pos); + err = do_xino_fwrite(func, file, buf, size, pos); TraceErr(err); return err; @@ -218,12 +218,13 @@ int xino_write(struct super_block *sb, a br = stobr(sb, bindex); DEBUG_ON(!br || !br->br_xino); pos = hidden_ino * sizeof(hidden_ino); - sz = fwrite(br->br_xino_write, br->br_xino, &ino, sizeof(ino), &pos); + sz = xino_fwrite(br->br_xino_write, br->br_xino, &ino, sizeof(ino), + &pos); //if (LktrCond) sz = 1; if (sz == sizeof(ino)) return 0; /* success */ - IOErr("write failed (%d)\n", sz); + IOErr("write failed (%ld)\n", (long)sz); return -EIO; } @@ -261,7 +262,7 @@ int xino_read(struct super_block *sb, au sz = 0; pos2 = pos = hidden_ino * sizeof(hidden_ino); if (i_size_read(file->f_dentry->d_inode) >= pos + sizeof(*ino)) { - sz = fread(br->br_xino_read, file, ino, sizeof(*ino), &pos); + sz = xino_fread(br->br_xino_read, file, ino, sizeof(*ino), &pos); //if (LktrCond) sz = 1; if (sz == sizeof(*ino) && *ino) return 0; /* success */ @@ -272,18 +273,18 @@ int xino_read(struct super_block *sb, au if (!sz || sz == sizeof(*ino)) { *ino = atomic_long_inc_return(&stosi(sb)->si_xino); if (*ino >= AUFS_FIRST_INO) { - sz = fwrite(br->br_xino_write, file, ino, sizeof(*ino), - &pos2); + sz = xino_fwrite(br->br_xino_write, file, ino, + sizeof(*ino), &pos2); //if (LktrCond) sz = 1; if (sz == sizeof(ino)) return 0; /* success */ *ino = 0; - IOErr("write failed (%d)\n", sz); + IOErr("write failed (%ld)\n", (long)sz); return -EIO; } else goto out_overflow; } - IOErr("read failed (%d)\n", sz); + IOErr("read failed (%ld)\n", (long)sz); out: return -EIO; out_overflow: ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV