diff options
| author | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:23:54 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:23:54 -0800 |
| commit | ad8dcf57e93e8e5f9b815e786da35ef03fc70f89 (patch) | |
| tree | f3394afd32c183a41ccbc649859ad505c5e8c09c /fs | |
| parent | 4c7ed1860c0d21292284fb044c465ba00ce89b7f (diff) | |
v2.4.12 -> v2.4.12.1
- Trond Myklebust: deadlock checking in lockd server
- Tim Waugh: fix up parport wrong #define
- Christoph Hellwig: i2c update, ext2 cleanup
- Al Viro: fix partition handling sanity check.
- Trond Myklebust: make NFS use SLAB_NOFS, and not play games with PF_MEMALLOC
- Ben Fennema: UDF update
- Alan Cox: continued merging
- Chris Mason: get /proc buffer memory sizes right after buf-in-page-cache
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/attr.c | 2 | ||||
| -rw-r--r-- | fs/block_dev.c | 23 | ||||
| -rw-r--r-- | fs/devfs/util.c | 2 | ||||
| -rw-r--r-- | fs/ext2/Makefile | 2 | ||||
| -rw-r--r-- | fs/ext2/acl.c | 17 | ||||
| -rw-r--r-- | fs/ext2/file.c | 63 | ||||
| -rw-r--r-- | fs/ext2/inode.c | 8 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_super.c | 1 | ||||
| -rw-r--r-- | fs/lockd/clntproc.c | 13 | ||||
| -rw-r--r-- | fs/lockd/svclock.c | 19 | ||||
| -rw-r--r-- | fs/lockd/svcproc.c | 19 | ||||
| -rw-r--r-- | fs/locks.c | 13 | ||||
| -rw-r--r-- | fs/nfs/read.c | 2 | ||||
| -rw-r--r-- | fs/nfs/write.c | 4 | ||||
| -rw-r--r-- | fs/nfsd/nfsxdr.c | 1 | ||||
| -rw-r--r-- | fs/partitions/check.c | 1 | ||||
| -rw-r--r-- | fs/partitions/msdos.c | 17 | ||||
| -rw-r--r-- | fs/proc/array.c | 3 | ||||
| -rw-r--r-- | fs/proc/proc_misc.c | 7 | ||||
| -rw-r--r-- | fs/udf/balloc.c | 210 | ||||
| -rw-r--r-- | fs/udf/dir.c | 2 | ||||
| -rw-r--r-- | fs/udf/file.c | 22 | ||||
| -rw-r--r-- | fs/udf/ialloc.c | 5 | ||||
| -rw-r--r-- | fs/udf/inode.c | 58 | ||||
| -rw-r--r-- | fs/udf/namei.c | 22 | ||||
| -rw-r--r-- | fs/udf/super.c | 212 | ||||
| -rw-r--r-- | fs/udf/truncate.c | 15 | ||||
| -rw-r--r-- | fs/udf/udfdecl.h | 21 |
28 files changed, 334 insertions, 450 deletions
diff --git a/fs/attr.c b/fs/attr.c index 624f232e615e..eccf21e16ec7 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -137,7 +137,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr) (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; if (!error) - inode_setattr(inode, attr); + error = inode_setattr(inode, attr); } } unlock_kernel(); diff --git a/fs/block_dev.c b/fs/block_dev.c index 2df9d2a00686..5994b96ba36e 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -24,29 +24,6 @@ #define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512) -static inline unsigned int blksize_bits(unsigned int size) -{ - unsigned int bits = 8; - do { - bits++; - size >>= 1; - } while (size > 256); - return bits; -} - -static inline unsigned int block_size(kdev_t dev) -{ - int retval = BLOCK_SIZE; - int major = MAJOR(dev); - - if (blksize_size[major]) { - int minor = MINOR(dev); - if (blksize_size[major][minor]) - retval = blksize_size[major][minor]; - } - return retval; -} - static unsigned long max_block(kdev_t dev) { unsigned int retval = ~0U; diff --git a/fs/devfs/util.c b/fs/devfs/util.c index 225aecd483b2..db9658b8fce4 100644 --- a/fs/devfs/util.c +++ b/fs/devfs/util.c @@ -52,7 +52,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/devfs_fs_kernel.h> -#include <linux/malloc.h> +#include <linux/slab.h> #include <linux/vmalloc.h> #include <asm/bitops.h> diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile index aa8560f079b4..60e07beee083 100644 --- a/fs/ext2/Makefile +++ b/fs/ext2/Makefile @@ -9,7 +9,7 @@ O_TARGET := ext2.o -obj-y := acl.o balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ +obj-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \ ioctl.o namei.o super.o symlink.o obj-m := $(O_TARGET) diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c deleted file mode 100644 index 8920f55a0bbf..000000000000 --- a/fs/ext2/acl.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/fs/ext2/acl.c - * - * Copyright (C) 1993, 1994, 1995 - * Remy Card (card@masi.ibp.fr) - * Laboratoire MASI - Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - */ - -#include <linux/fs.h> -#include <linux/sched.h> - - -/* - * This file will contain the Access Control Lists management for the - * second extended file system. - */ diff --git a/fs/ext2/file.c b/fs/ext2/file.c index bf943d470fc3..8d978bdf66be 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -22,51 +22,6 @@ #include <linux/ext2_fs.h> #include <linux/sched.h> -static loff_t ext2_file_lseek(struct file *, loff_t, int); -static int ext2_open_file (struct inode *, struct file *); - -#define EXT2_MAX_SIZE(bits) \ - (((EXT2_NDIR_BLOCKS + (1LL << (bits - 2)) + \ - (1LL << (bits - 2)) * (1LL << (bits - 2)) + \ - (1LL << (bits - 2)) * (1LL << (bits - 2)) * (1LL << (bits - 2))) * \ - (1LL << bits)) - 1) - -static long long ext2_max_sizes[] = { -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -EXT2_MAX_SIZE(10), EXT2_MAX_SIZE(11), EXT2_MAX_SIZE(12), EXT2_MAX_SIZE(13) -}; - -/* - * Make sure the offset never goes beyond the 32-bit mark.. - */ -static loff_t ext2_file_lseek( - struct file *file, - loff_t offset, - int origin) -{ - struct inode *inode = file->f_dentry->d_inode; - - switch (origin) { - case 2: - offset += inode->i_size; - break; - case 1: - offset += file->f_pos; - } - if (offset<0) - return -EINVAL; - if (((unsigned long long) offset >> 32) != 0) { - if (offset > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)]) - return -EINVAL; - } - if (offset != file->f_pos) { - file->f_pos = offset; - file->f_reada = 0; - file->f_version = ++event; - } - return offset; -} - /* * Called when an inode is released. Note that this is different * from ext2_open_file: open gets called at every open, but release @@ -80,30 +35,16 @@ static int ext2_release_file (struct inode * inode, struct file * filp) } /* - * Called when an inode is about to be open. - * We use this to disallow opening RW large files on 32bit systems if - * the caller didn't specify O_LARGEFILE. On 64bit systems we force - * on this flag in sys_open. - */ -static int ext2_open_file (struct inode * inode, struct file * filp) -{ - if (!(filp->f_flags & O_LARGEFILE) && - inode->i_size > 0x7FFFFFFFLL) - return -EFBIG; - return 0; -} - -/* * We have mostly NULL's here: the current defaults are ok for * the ext2 filesystem. */ struct file_operations ext2_file_operations = { - llseek: ext2_file_lseek, + llseek: generic_file_llseek, read: generic_file_read, write: generic_file_write, ioctl: ext2_ioctl, mmap: generic_file_mmap, - open: ext2_open_file, + open: generic_file_open, release: ext2_release_file, fsync: ext2_sync_file, }; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 271cbd15b733..8e138cc9a2ad 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -29,6 +29,12 @@ #include <linux/sched.h> #include <linux/highuid.h> #include <linux/quotaops.h> +#include <linux/module.h> + +MODULE_AUTHOR("Remy Card and others"); +MODULE_DESCRIPTION("Second Extended Filesystem"); +MODULE_LICENSE("GPL"); + static int ext2_update_inode(struct inode * inode, int do_sync); @@ -592,7 +598,7 @@ struct address_space_operations ext2_aops = { sync_page: block_sync_page, prepare_write: ext2_prepare_write, commit_write: generic_commit_write, - bmap: ext2_bmap, + bmap: ext2_bmap }; /* diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 9a06acb8d50d..99b265f0acf4 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -49,6 +49,7 @@ MODULE_AUTHOR("Christoph Hellwig"); MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver"); +MODULE_LICENSE("Dual BSD/GPL"); static void vxfs_put_super(struct super_block *); diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 883e4cc58698..d7d00ed2ce98 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -6,6 +6,7 @@ * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */ +#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/fs.h> @@ -676,6 +677,18 @@ nlm_stat_to_errno(u32 status) case NLM_LCK_BLOCKED: printk(KERN_NOTICE "lockd: unexpected status NLM_BLOCKED\n"); return -ENOLCK; +#ifdef CONFIG_LOCKD_V4 + case NLM_DEADLCK: + return -EDEADLK; + case NLM_ROFS: + return -EROFS; + case NLM_STALE_FH: + return -ESTALE; + case NLM_FBIG: + return -EOVERFLOW; + case NLM_FAILED: + return -ENOLCK; +#endif } printk(KERN_NOTICE "lockd: unexpected server status %d\n", status); return -ENOLCK; diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 078f568b78ba..2b8113d747da 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -31,9 +31,14 @@ #include <linux/lockd/nlm.h> #include <linux/lockd/lockd.h> - #define NLMDBG_FACILITY NLMDBG_SVCLOCK +#ifdef CONFIG_LOCKD_V4 +#define nlm_deadlock nlm4_deadlock +#else +#define nlm_deadlock nlm_lck_denied +#endif + static void nlmsvc_insert_block(struct nlm_block *block, unsigned long); static int nlmsvc_remove_block(struct nlm_block *block); static void nlmsvc_grant_callback(struct rpc_task *task); @@ -330,12 +335,7 @@ again: case 0: return nlm_granted; case EDEADLK: -#ifdef CONFIG_LOCKD_V4 - return nlm4_deadlock; /* will be downgraded to lck_deined if this - * is a NLMv1,3 request */ -#else - /* no applicable NLM status */ -#endif + return nlm_deadlock; case EAGAIN: return nlm_lck_denied; default: /* includes ENOLCK */ @@ -348,6 +348,11 @@ again: return nlm_lck_denied; } + if (posix_locks_deadlock(&lock->fl, conflock)) { + up(&file->f_sema); + return nlm_deadlock; + } + /* If we don't have a block, create and initialize it. Then * retry because we may have slept in kmalloc. */ if (block == NULL) { diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 6af031e95125..a5283be9b170 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -29,17 +29,20 @@ static void nlmsvc_callback_exit(struct rpc_task *); static u32 cast_to_nlm(u32 status, u32 vers) { - + /* Note: status is assumed to be in network byte order !!! */ if (vers != 4){ - switch(ntohl(status)){ - case NLM_LCK_GRANTED: - case NLM_LCK_DENIED: - case NLM_LCK_DENIED_NOLOCKS: - case NLM_LCK_BLOCKED: - case NLM_LCK_DENIED_GRACE_PERIOD: + switch (status) { + case nlm_granted: + case nlm_lck_denied: + case nlm_lck_denied_nolocks: + case nlm_lck_blocked: + case nlm_lck_denied_grace_period: + break; + case nlm4_deadlock: + status = nlm_lck_denied; break; default: - status = NLM_LCK_DENIED_NOLOCKS; + status = nlm_lck_denied_nolocks; } } diff --git a/fs/locks.c b/fs/locks.c index 6cc49cdd1973..e85e1f8463c9 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -548,7 +548,7 @@ static int locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl) return (1); default: - printk("locks_conflict(): impossible lock type - %d\n", + printk(KERN_ERR "locks_conflict(): impossible lock type - %d\n", caller_fl->fl_type); break; } @@ -660,7 +660,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl) * from a broken NFS client. But broken NFS clients have a lot more to * worry about than proper deadlock detection anyway... --okir */ -static int posix_locks_deadlock(struct file_lock *caller_fl, +int posix_locks_deadlock(struct file_lock *caller_fl, struct file_lock *block_fl) { struct list_head *tmp; @@ -715,6 +715,9 @@ int locks_mandatory_area(int read_write, struct inode *inode, struct file_lock *new_fl = locks_alloc_lock(0); int error; + if (new_fl == NULL) + return -ENOMEM; + new_fl->fl_owner = current->files; new_fl->fl_pid = current->pid; new_fl->fl_file = filp; @@ -1428,6 +1431,9 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l) struct inode *inode; int error; + if (file_lock == NULL) + return -ENOLCK; + /* * This might block, so we do it before checking the inode. */ @@ -1581,6 +1587,9 @@ int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l) struct inode *inode; int error; + if (file_lock == NULL) + return -ENOLCK; + /* * This might block, so we do it before checking the inode. */ diff --git a/fs/nfs/read.c b/fs/nfs/read.c index a58b0be4c63a..1d27255ccf0d 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -59,7 +59,7 @@ static kmem_cache_t *nfs_rdata_cachep; static __inline__ struct nfs_read_data *nfs_readdata_alloc(void) { struct nfs_read_data *p; - p = kmem_cache_alloc(nfs_rdata_cachep, SLAB_NFS); + p = kmem_cache_alloc(nfs_rdata_cachep, SLAB_NOFS); if (p) { memset(p, 0, sizeof(*p)); INIT_LIST_HEAD(&p->pages); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 8fe2b47874a8..fa1e4efaf54a 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -109,7 +109,7 @@ static kmem_cache_t *nfs_wdata_cachep; static __inline__ struct nfs_page *nfs_page_alloc(void) { struct nfs_page *p; - p = kmem_cache_alloc(nfs_page_cachep, SLAB_KERNEL); + p = kmem_cache_alloc(nfs_page_cachep, SLAB_NOFS); if (p) { memset(p, 0, sizeof(*p)); INIT_LIST_HEAD(&p->wb_hash); @@ -127,7 +127,7 @@ static __inline__ void nfs_page_free(struct nfs_page *p) static __inline__ struct nfs_write_data *nfs_writedata_alloc(void) { struct nfs_write_data *p; - p = kmem_cache_alloc(nfs_wdata_cachep, SLAB_NFS); + p = kmem_cache_alloc(nfs_wdata_cachep, SLAB_NOFS); if (p) { memset(p, 0, sizeof(*p)); INIT_LIST_HEAD(&p->pages); diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index debae923e8f2..8d25e5095f13 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -70,7 +70,6 @@ decode_filename(u32 *p, char **namp, int *lenp) if (*name == '\0' || *name == '/') return NULL; } - *name = '\0'; } return p; diff --git a/fs/partitions/check.c b/fs/partitions/check.c index ee0ce88fed84..e933009d4f63 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -247,6 +247,7 @@ static void check_partition(struct gendisk *hd, kdev_t dev, int first_part_minor printk(KERN_INFO " %s:", disk_name(hd, MINOR(dev), buf)); bdev = bdget(kdev_t_to_nr(dev)); bdev->bd_inode->i_size = (loff_t)hd->part[MINOR(dev)].nr_sects << 9; + bdev->bd_inode->i_blkbits = blksize_bits(block_size(dev)); for (i = 0; check_part[i]; i++) { int res; res = check_part[i](hd, bdev, first_sector, first_part_minor); diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 8777f50178a9..68a58ff9de97 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c @@ -103,21 +103,20 @@ msdos_magic_present(unsigned char *p) */ static void extended_partition(struct gendisk *hd, struct block_device *bdev, - int minor, int *current_minor) + int minor, unsigned long first_size, int *current_minor) { struct partition *p; Sector sect; unsigned char *data; - unsigned long first_sector, first_size, this_sector, this_size; + unsigned long first_sector, this_sector, this_size; int mask = (1 << hd->minor_shift) - 1; int sector_size = get_hardsect_size(to_kdev_t(bdev->bd_dev)) / 512; int loopct = 0; /* number of links followed without finding a data partition */ int i; - first_sector = hd->part[minor].start_sect; - first_size = hd->part[minor].nr_sects; - this_sector = first_sector; + this_sector = first_sector = hd->part[minor].start_sect; + this_size = first_size; while (1) { if (++loopct > 100) @@ -133,8 +132,6 @@ static void extended_partition(struct gendisk *hd, struct block_device *bdev, p = (struct partition *) (data + 0x1be); - this_size = hd->part[minor].nr_sects; - /* * Usually, the first entry is the real data partition, * the 2nd entry is the next extended partition, or empty, @@ -196,6 +193,7 @@ static void extended_partition(struct gendisk *hd, struct block_device *bdev, goto done; /* nothing left to do */ this_sector = first_sector + START_SECT(p) * sector_size; + this_size = NR_SECTS(p) * sector_size; minor = *current_minor; put_dev_sector(sect); } @@ -586,12 +584,13 @@ int msdos_partition(struct gendisk *hd, struct block_device *bdev, } #endif if (is_extended_partition(p)) { + unsigned long size = hd->part[minor].nr_sects; printk(" <"); /* prevent someone doing mkfs or mkswap on an extended partition, but leave room for LILO */ - if (hd->part[minor].nr_sects > 2) + if (size > 2) hd->part[minor].nr_sects = 2; - extended_partition(hd, bdev, minor, ¤t_minor); + extended_partition(hd, bdev, minor, size, ¤t_minor); printk(" >"); } } diff --git a/fs/proc/array.c b/fs/proc/array.c index 8ec5fdc95d81..d8738e51bb0f 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -151,12 +151,13 @@ static inline char * task_state(struct task_struct *p, char *buffer) read_lock(&tasklist_lock); buffer += sprintf(buffer, "State:\t%s\n" + "Tgid:\t%d\n" "Pid:\t%d\n" "PPid:\t%d\n" "TracerPid:\t%d\n" "Uid:\t%d\t%d\t%d\t%d\n" "Gid:\t%d\t%d\t%d\t%d\n", - get_task_state(p), + get_task_state(p), p->tgid, p->pid, p->pid ? p->p_opptr->pid : 0, 0, p->uid, p->euid, p->suid, p->fsuid, p->gid, p->egid, p->sgid, p->fsgid); diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index f041736e515f..e1601dba7ca8 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -140,6 +140,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, { struct sysinfo i; int len; + int pg_size ; /* * display in kilobytes. @@ -148,12 +149,14 @@ static int meminfo_read_proc(char *page, char **start, off_t off, #define B(x) ((unsigned long long)(x) << PAGE_SHIFT) si_meminfo(&i); si_swapinfo(&i); + pg_size = atomic_read(&page_cache_size) - i.bufferram ; + len = sprintf(page, " total: used: free: shared: buffers: cached:\n" "Mem: %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n" "Swap: %8Lu %8Lu %8Lu\n", B(i.totalram), B(i.totalram-i.freeram), B(i.freeram), B(i.sharedram), B(i.bufferram), - B(atomic_read(&page_cache_size)), B(i.totalswap), + B(pg_size), B(i.totalswap), B(i.totalswap-i.freeswap), B(i.freeswap)); /* * Tagged format, for easy grepping and expansion. @@ -179,7 +182,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, K(i.freeram), K(i.sharedram), K(i.bufferram), - K(atomic_read(&page_cache_size) - swapper_space.nrpages), + K(pg_size - swapper_space.nrpages), K(swapper_space.nrpages), K(nr_active_pages), K(nr_inactive_pages), diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 0d82b45ea34f..982a7f808620 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c @@ -44,12 +44,15 @@ #define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x) #define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y) #define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) +#define UintBPL Uint(BITS_PER_LONG) +#define Uint(x) xUint(x) +#define xUint(x) Uint ## x extern inline int find_next_one_bit (void * addr, int size, int offset) { - unsigned long * p = ((unsigned long *) addr) + (offset / BITS_PER_LONG); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; + UintBPL * p = ((UintBPL *) addr) + (offset / BITS_PER_LONG); + UintBPL result = offset & ~(BITS_PER_LONG-1); + UintBPL tmp; if (offset >= size) return size; @@ -126,7 +129,7 @@ static int __load_block_bitmap(struct super_block * sb, } } -static inline int load_block_bitmap(struct super_block *sb, +static inline int load_block_bitmap(struct super_block * sb, struct udf_bitmap *bitmap, unsigned int block_group) { int slot; @@ -142,7 +145,8 @@ static inline int load_block_bitmap(struct super_block *sb, return slot; } -static void udf_bitmap_free_blocks(struct inode * inode, +static void udf_bitmap_free_blocks(struct super_block * sb, + struct inode * inode, struct udf_bitmap *bitmap, lb_addr bloc, Uint32 offset, Uint32 count) { struct buffer_head * bh = NULL; @@ -152,14 +156,6 @@ static void udf_bitmap_free_blocks(struct inode * inode, unsigned long i; int bitmap_nr; unsigned long overflow; - struct super_block * sb; - - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device"); - return; - } lock_super(sb); if (bloc.logicalBlockNum < 0 || @@ -200,7 +196,8 @@ do_more: } else { - DQUOT_FREE_BLOCK(inode, 1); + if (inode) + DQUOT_FREE_BLOCK(inode, 1); if (UDF_SB_LVIDBH(sb)) { UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)] = @@ -223,7 +220,8 @@ error_return: return; } -static int udf_bitmap_prealloc_blocks(struct inode * inode, +static int udf_bitmap_prealloc_blocks(struct super_block * sb, + struct inode * inode, struct udf_bitmap *bitmap, Uint16 partition, Uint32 first_block, Uint32 block_count) { @@ -231,14 +229,7 @@ static int udf_bitmap_prealloc_blocks(struct inode * inode, int bit, block, block_group, group_start; int nr_groups, bitmap_nr; struct buffer_head *bh; - struct super_block *sb; - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device\n"); - return 0; - } lock_super(sb); if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition)) @@ -293,23 +284,17 @@ out: return alloc_count; } -static int udf_bitmap_new_block(struct inode * inode, +static int udf_bitmap_new_block(struct super_block * sb, + struct inode * inode, struct udf_bitmap *bitmap, Uint16 partition, Uint32 goal, int *err) { int newbit, bit=0, block, block_group, group_start; int end_goal, nr_groups, bitmap_nr, i; struct buffer_head *bh = NULL; - struct super_block *sb; char *ptr; int newblock = 0; *err = -ENOSPC; - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device\n"); - return newblock; - } lock_super(sb); repeat: @@ -404,7 +389,7 @@ got_block: /* * Check quota for allocation of this block. */ - if (DQUOT_ALLOC_BLOCK(inode, 1)) + if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) { unlock_super(sb); *err = -EDQUOT; @@ -439,30 +424,17 @@ error_return: return 0; } -static void udf_table_free_blocks(struct inode * inode, +static void udf_table_free_blocks(struct super_block * sb, + struct inode * inode, struct inode * table, lb_addr bloc, Uint32 offset, Uint32 count) { - struct super_block * sb; Uint32 start, end; Uint32 nextoffset, oextoffset, elen; lb_addr nbloc, obloc, eloc; struct buffer_head *obh, *nbh; - char etype; + Sint8 etype; int i; - udf_debug("ino=%ld, bloc=%d, offset=%d, count=%d\n", - inode->i_ino, bloc.logicalBlockNum, offset, count); - - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device"); - return; - } - - if (table == NULL) - return; - lock_super(sb); if (bloc.logicalBlockNum < 0 || (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) @@ -475,7 +447,8 @@ static void udf_table_free_blocks(struct inode * inode, /* We do this up front - There are some error conditions that could occure, but.. oh well */ - DQUOT_FREE_BLOCK(inode, count); + if (inode) + DQUOT_FREE_BLOCK(inode, count); if (UDF_SB_LVIDBH(sb)) { UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)] = @@ -690,33 +663,20 @@ error_return: return; } -static int udf_table_prealloc_blocks(struct inode * inode, +static int udf_table_prealloc_blocks(struct super_block * sb, + struct inode * inode, struct inode *table, Uint16 partition, Uint32 first_block, Uint32 block_count) { - struct super_block *sb; int alloc_count = 0; Uint32 extoffset, elen, adsize; lb_addr bloc, eloc; struct buffer_head *bh; - char etype = -1; - - udf_debug("ino=%ld, partition=%d, first_block=%d, block_count=%d\n", - inode->i_ino, partition, first_block, block_count); - - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device\n"); - return 0; - } + Sint8 etype = -1; if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition)) return 0; - if (table == NULL) - return 0; - if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_SHORT) adsize = sizeof(short_ad); else if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_LONG) @@ -745,7 +705,9 @@ static int udf_table_prealloc_blocks(struct inode * inode, extoffset -= adsize; alloc_count = (elen >> sb->s_blocksize_bits); - if (alloc_count > block_count) + if (inode && DQUOT_PREALLOC_BLOCK(inode, alloc_count > block_count ? block_count : alloc_count)) + alloc_count = 0; + else if (alloc_count > block_count) { alloc_count = block_count; eloc.logicalBlockNum += alloc_count; @@ -765,37 +727,24 @@ static int udf_table_prealloc_blocks(struct inode * inode, UDF_SB_LVID(sb)->freeSpaceTable[partition] = cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[partition])-alloc_count); mark_buffer_dirty(UDF_SB_LVIDBH(sb)); + sb->s_dirt = 1; } - sb->s_dirt = 1; unlock_super(sb); - udf_debug("alloc_count=%d\n", alloc_count); return alloc_count; } -static int udf_table_new_block(const struct inode * inode, +static int udf_table_new_block(struct super_block * sb, + struct inode * inode, struct inode *table, Uint16 partition, Uint32 goal, int *err) { - struct super_block *sb; Uint32 spread = 0xFFFFFFFF, nspread; Uint32 newblock = 0, adsize; Uint32 extoffset, goal_extoffset, elen, goal_elen = 0; lb_addr bloc, goal_bloc, eloc, goal_eloc; struct buffer_head *bh, *goal_bh; - char etype; - - udf_debug("ino=%ld, partition=%d, goal=%d\n", - inode->i_ino, partition, goal); + Sint8 etype; *err = -ENOSPC; - sb = inode->i_sb; - if (!sb) - { - udf_debug("nonexistent device\n"); - return newblock; - } - - if (table == NULL) - return newblock; if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_SHORT) adsize = sizeof(short_ad); @@ -868,6 +817,14 @@ static int udf_table_new_block(const struct inode * inode, goal_eloc.logicalBlockNum ++; goal_elen -= sb->s_blocksize; + if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) + { + udf_release_data(goal_bh); + unlock_super(sb); + *err = -EDQUOT; + return 0; + } + if (goal_elen) udf_write_aext(table, goal_bloc, &goal_extoffset, goal_eloc, goal_elen, goal_bh, 1); else @@ -887,93 +844,98 @@ static int udf_table_new_block(const struct inode * inode, return newblock; } -inline void udf_free_blocks(struct inode * inode, lb_addr bloc, - Uint32 offset, Uint32 count) +inline void udf_free_blocks(struct super_block * sb, + struct inode * inode, + lb_addr bloc, Uint32 offset, Uint32 count) { - if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_UNALLOC_BITMAP) + Uint16 partition = bloc.partitionReferenceNum; + + if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) { - return udf_bitmap_free_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_uspace.s_bitmap, + return udf_bitmap_free_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap, bloc, offset, count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_UNALLOC_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) { - return udf_table_free_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_uspace.s_table, + return udf_table_free_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_table, bloc, offset, count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_FREED_BITMAP) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) { - return udf_bitmap_free_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_fspace.s_bitmap, + return udf_bitmap_free_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_bitmap, bloc, offset, count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_FREED_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) { - return udf_table_free_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_fspace.s_table, + return udf_table_free_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_table, bloc, offset, count); } else return; } -inline int udf_prealloc_blocks(struct inode * inode, Uint16 partition, - Uint32 first_block, Uint32 block_count) +inline int udf_prealloc_blocks(struct super_block * sb, + struct inode * inode, + Uint16 partition, Uint32 first_block, Uint32 block_count) { - if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) + if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) { - return udf_bitmap_prealloc_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.s_bitmap, + return udf_bitmap_prealloc_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap, partition, first_block, block_count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) { - return udf_table_prealloc_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.s_table, + return udf_table_prealloc_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_table, partition, first_block, block_count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_BITMAP) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) { - return udf_bitmap_prealloc_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.s_bitmap, + return udf_bitmap_prealloc_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_bitmap, partition, first_block, block_count); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) { - return udf_table_prealloc_blocks(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.s_table, + return udf_table_prealloc_blocks(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_table, partition, first_block, block_count); } else return 0; } -inline int udf_new_block(struct inode * inode, Uint16 partition, - Uint32 goal, int *err) +inline int udf_new_block(struct super_block * sb, + struct inode * inode, + Uint16 partition, Uint32 goal, int *err) { - if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) + if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) { - return udf_bitmap_new_block(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.s_bitmap, + return udf_bitmap_new_block(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_bitmap, partition, goal, err); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) { - return udf_table_new_block(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.s_table, + return udf_table_new_block(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_uspace.s_table, partition, goal, err); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_BITMAP) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) { - return udf_bitmap_new_block(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.s_bitmap, + return udf_bitmap_new_block(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_bitmap, partition, goal, err); } - else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_TABLE) + else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) { - return udf_table_new_block(inode, - UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.s_table, + return udf_table_new_block(sb, inode, + UDF_SB_PARTMAPS(sb)[partition].s_fspace.s_table, partition, goal, err); } else diff --git a/fs/udf/dir.c b/fs/udf/dir.c index d3f42ca9306d..7a13d861ccfd 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -186,7 +186,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d udf_release_data(fibh.ebh); udf_release_data(fibh.sbh); udf_release_data(bh); - return -ENOENT; + return 0; } liu = le16_to_cpu(cfi.lengthOfImpUse); diff --git a/fs/udf/file.c b/fs/udf/file.c index 1f8f28f9a74a..33ff393177dc 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -206,7 +206,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf, int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - int result = -1; + int result = -EINVAL; struct buffer_head *bh = NULL; long_ad eaicb; Uint8 *ea = NULL; @@ -228,16 +228,16 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, switch (cmd) { case UDF_GETVOLIDENT: - if ( (result == verify_area(VERIFY_WRITE, (char *)arg, 32)) == 0) - result = copy_to_user((char *)arg, UDF_SB_VOLIDENT(inode->i_sb), 32); - return result; + return copy_to_user((char *)arg, + UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0; case UDF_RELOCATE_BLOCKS: { long old, new; if (!capable(CAP_SYS_ADMIN)) return -EACCES; - get_user(old, (long *)arg); - if ((result = udf_relocate_blocks(inode->i_sb, old, &new)) == 0) + if (get_user(old, (long *)arg)) return -EFAULT; + if ((result = udf_relocate_blocks(inode->i_sb, + old, &new)) == 0) result = put_user(new, (long *)arg); return result; @@ -277,16 +277,12 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, switch (cmd) { case UDF_GETEASIZE: - if ( (result = verify_area(VERIFY_WRITE, (char *)arg, 4)) == 0) - result = put_user(UDF_I_LENEATTR(inode), (int *)arg); + result = put_user(UDF_I_LENEATTR(inode), (int *)arg); break; case UDF_GETEABLOCK: - if ( (result = verify_area(VERIFY_WRITE, (char *)arg, UDF_I_LENEATTR(inode))) == 0) - result = copy_to_user((char *)arg, ea, UDF_I_LENEATTR(inode)); - break; - - default: + result = copy_to_user((char *)arg, ea, + UDF_I_LENEATTR(inode)) ? -EFAULT : 0; break; } diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 87553905b8f6..7d44903b1c1a 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c @@ -64,10 +64,9 @@ void udf_free_inode(struct inode * inode) mark_buffer_dirty(UDF_SB_LVIDBH(sb)); } - unlock_super(sb); - udf_free_blocks(inode, UDF_I_LOCATION(inode), 0, 1); + udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1); } struct inode * udf_new_inode (struct inode *dir, int mode, int * err) @@ -87,7 +86,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) } *err = -ENOSPC; - block = udf_new_block(dir, UDF_I_LOCATION(dir).partitionReferenceNum, + block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, start, err); if (*err) { diff --git a/fs/udf/inode.c b/fs/udf/inode.c index ff919240c212..897e469aa089 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -236,7 +236,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int } /* alloc block, and copy data to it */ - *block = udf_new_block(inode, + *block = udf_new_block(inode->i_sb, inode, UDF_I_LOCATION(inode).partitionReferenceNum, UDF_I_LOCATION(inode).logicalBlockNum, err); @@ -302,7 +302,6 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &sbh, 0); /* UniqueID stuff */ - inode->i_blocks = inode->i_sb->s_blocksize / 512; mark_buffer_dirty(sbh); udf_release_data(sbh); mark_inode_dirty(inode); @@ -402,14 +401,14 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, Uint32 elen = 0; lb_addr eloc, pbloc, cbloc, nbloc; int c = 1; - int lbcount = 0, b_off = 0, offset = 0; - Uint32 newblocknum, newblock; - char etype; + Uint64 lbcount = 0, b_off = 0; + Uint32 newblocknum, newblock, offset = 0; + Sint8 etype; int goal = 0, pgoal = UDF_I_LOCATION(inode).logicalBlockNum; char lastblock = 0; pextoffset = cextoffset = nextoffset = udf_file_entry_alloc_offset(inode); - b_off = block << inode->i_sb->s_blocksize_bits; + b_off = (Uint64)block << inode->i_sb->s_blocksize_bits; pbloc = cbloc = nbloc = UDF_I_LOCATION(inode); /* find the extent which contains the block we are looking for. @@ -546,7 +545,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, goal = UDF_I_LOCATION(inode).logicalBlockNum + 1; } - if (!(newblocknum = udf_new_block(inode, + if (!(newblocknum = udf_new_block(inode->i_sb, inode, UDF_I_LOCATION(inode).partitionReferenceNum, goal, err))) { udf_release_data(pbh); @@ -588,7 +587,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, UDF_I_NEXT_ALLOC_GOAL(inode) = newblocknum; inode->i_ctime = CURRENT_TIME; UDF_I_UCTIME(inode) = CURRENT_UTIME; - inode->i_blocks += inode->i_sb->s_blocksize / 512; + if (IS_SYNC(inode)) udf_sync_inode(inode); else @@ -692,7 +691,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, int next = laarr[start].extLocation.logicalBlockNum + (((laarr[start].extLength & UDF_EXTENT_LENGTH_MASK) + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits); - int numalloc = udf_prealloc_blocks(inode, + int numalloc = udf_prealloc_blocks(inode->i_sb, inode, laarr[start].extLocation.partitionReferenceNum, next, (UDF_DEFAULT_PREALLOC_BLOCKS > length ? length : UDF_DEFAULT_PREALLOC_BLOCKS) - currlength); @@ -825,9 +824,6 @@ struct buffer_head * udf_bread(struct inode * inode, int block, int create, int * err) { struct buffer_head * bh = NULL; - int prev_blocks; - - prev_blocks = inode->i_blocks; bh = udf_getblk(inode, block, create, err); if (!bh) @@ -1602,7 +1598,7 @@ udf_iget(struct super_block *sb, lb_addr ino) return inode; } -int udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, +Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, lb_addr eloc, Uint32 elen, struct buffer_head **bh, int inc) { int adsize; @@ -1637,7 +1633,7 @@ int udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, int err, loffset; lb_addr obloc = *bloc; - if (!(bloc->logicalBlockNum = udf_new_block(inode, + if (!(bloc->logicalBlockNum = udf_new_block(inode->i_sb, inode, obloc.partitionReferenceNum, obloc.logicalBlockNum, &err))) { return -1; @@ -1739,7 +1735,7 @@ int udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, return ret; } -int udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset, +Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset, lb_addr eloc, Uint32 elen, struct buffer_head *bh, int inc) { int adsize; @@ -1808,12 +1804,12 @@ int udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset, return (elen >> 30); } -int udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset, +Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset, lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc) { Uint16 tagIdent; int pos, alen; - Uint8 etype; + Sint8 etype; if (!(*bh)) { @@ -1932,11 +1928,11 @@ int udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset, return -1; } -int udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset, +Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset, lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc) { int pos, alen; - Uint8 etype; + Sint8 etype; if (!(*bh)) { @@ -2013,12 +2009,12 @@ int udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset, return -1; } -int udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset, +Sint8 udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset, lb_addr neloc, Uint32 nelen, struct buffer_head *bh) { lb_addr oeloc; Uint32 oelen; - int type; + Sint8 etype; if (!bh) { @@ -2034,25 +2030,25 @@ int udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset, else atomic_inc(&bh->b_count); - while ((type = udf_next_aext(inode, &bloc, &extoffset, &oeloc, &oelen, &bh, 0)) != -1) + while ((etype = udf_next_aext(inode, &bloc, &extoffset, &oeloc, &oelen, &bh, 0)) != -1) { udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1); neloc = oeloc; - nelen = (type << 30) | oelen; + nelen = (etype << 30) | oelen; } udf_add_aext(inode, &bloc, &extoffset, neloc, nelen, &bh, 1); udf_release_data(bh); return (nelen >> 30); } -int udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, +Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, lb_addr eloc, Uint32 elen, struct buffer_head *nbh) { struct buffer_head *obh; lb_addr obloc; int oextoffset, adsize; - char type; + Sint8 etype; struct AllocExtDesc *aed; if (!(nbh)) @@ -2084,9 +2080,9 @@ int udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, if (udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1) == -1) return -1; - while ((type = udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1)) != -1) + while ((etype = udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1)) != -1) { - udf_write_aext(inode, obloc, &oextoffset, eloc, (type << 30) | elen, obh, 1); + udf_write_aext(inode, obloc, &oextoffset, eloc, (etype << 30) | elen, obh, 1); if (memcmp(&nbloc, &obloc, sizeof(lb_addr))) { obloc = nbloc; @@ -2101,7 +2097,7 @@ int udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, if (memcmp(&nbloc, &obloc, sizeof(lb_addr))) { - udf_free_blocks(inode, nbloc, 0, 1); + udf_free_blocks(inode->i_sb, inode, nbloc, 0, 1); udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1); udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1); if (!memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr))) @@ -2147,11 +2143,11 @@ int udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, return (elen >> 30); } -int inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset, +Sint8 inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset, lb_addr *eloc, Uint32 *elen, Uint32 *offset, struct buffer_head **bh) { - Uint64 lbcount = 0, bcount = block << inode->i_sb->s_blocksize_bits; - char etype; + Uint64 lbcount = 0, bcount = (Uint64)block << inode->i_sb->s_blocksize_bits; + Sint8 etype; if (block < 0) { diff --git a/fs/udf/namei.c b/fs/udf/namei.c index b5823d5d9849..7b6f0a674578 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -835,7 +835,7 @@ static int empty_dir(struct inode *dir) static int udf_rmdir(struct inode * dir, struct dentry * dentry) { int retval; - struct inode * inode; + struct inode * inode = dentry->d_inode; struct udf_fileident_bh fibh; struct FileIdentDesc *fi, cfi; @@ -844,9 +844,6 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry) if (!fi) goto out; - inode = dentry->d_inode; - DQUOT_INIT(inode); - retval = -EIO; if (udf_get_lb_pblock(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation), 0) != inode->i_ino) goto end_rmdir; @@ -881,7 +878,7 @@ out: static int udf_unlink(struct inode * dir, struct dentry * dentry) { int retval; - struct inode * inode; + struct inode * inode = dentry->d_inode; struct udf_fileident_bh fibh; struct FileIdentDesc *fi; struct FileIdentDesc cfi; @@ -891,9 +888,6 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry) if (!fi) goto out; - inode = dentry->d_inode; - DQUOT_INIT(inode); - retval = -EIO; if (udf_get_lb_pblock(dir->i_sb, lelb_to_cpu(cfi.icb.extLocation), 0) != @@ -954,7 +948,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * lb_addr bloc, eloc; Uint32 elen, extoffset; - block = udf_new_block(inode, + block = udf_new_block(inode->i_sb, inode, UDF_I_LOCATION(inode).partitionReferenceNum, UDF_I_LOCATION(inode).logicalBlockNum, &err); if (!block) @@ -968,7 +962,6 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 0); udf_release_data(bh); - inode->i_blocks = inode->i_sb->s_blocksize / 512; block = udf_get_pblock(inode->i_sb, block, UDF_I_LOCATION(inode).partitionReferenceNum, 0); bh = udf_tread(inode->i_sb, block, inode->i_sb->s_blocksize); @@ -1150,13 +1143,13 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir, static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry) { - struct inode * old_inode, * new_inode; + struct inode * old_inode = old_dentry->d_inode; + struct inode * new_inode = new_dentry->d_inode; struct udf_fileident_bh ofibh, nfibh; struct FileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL, ocfi, ncfi; struct buffer_head *dir_bh = NULL; int retval = -ENOENT; - old_inode = old_dentry->d_inode; if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi))) { if (ofibh.sbh != ofibh.ebh) @@ -1169,7 +1162,6 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, goto end_rename; } - new_inode = new_dentry->d_inode; nfi = udf_find_entry(new_dir, new_dentry, &nfibh, &ncfi); if (nfi) { @@ -1180,10 +1172,6 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, udf_release_data(nfibh.sbh); nfi = NULL; } - else - { - DQUOT_INIT(new_inode); - } } if (S_ISDIR(old_inode->i_mode)) { diff --git a/fs/udf/super.c b/fs/udf/super.c index d04b47516b15..034064dfdf20 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -85,7 +85,7 @@ static int udf_vrs(struct super_block *sb, int silent); static int udf_load_partition(struct super_block *, lb_addr *); static int udf_load_logicalvol(struct super_block *, struct buffer_head *, lb_addr *); static void udf_load_logicalvolint(struct super_block *, extent_ad); -static int udf_find_anchor(struct super_block *, int, int); +static void udf_find_anchor(struct super_block *); static int udf_find_fileset(struct super_block *, lb_addr *, lb_addr *); static void udf_load_pvoldesc(struct super_block *, struct buffer_head *); static void udf_load_fileset(struct super_block *, struct buffer_head *, lb_addr *); @@ -164,7 +164,7 @@ module_exit(exit_udf_fs) * noadinicb Don't embed data in the inode * shortad Use short ad's * longad Use long ad's (default) - * strict Set strict conformance + * nostrict Unset strict conformance * iocharset= Set the NLS character set * * The remaining are for debugging and disaster recovery: @@ -208,8 +208,8 @@ udf_parse_options(char *options, struct udf_options *uopt) uopt->blocksize = 2048; uopt->partition = 0xFFFF; uopt->session = 0xFFFFFFFF; - uopt->lastblock = 0xFFFFFFFF; - uopt->anchor = 0xFFFFFFFF; + uopt->lastblock = 0; + uopt->anchor = 0; uopt->volume = 0xFFFFFFFF; uopt->rootdir = 0xFFFFFFFF; uopt->fileset = 0xFFFFFFFF; @@ -244,8 +244,8 @@ udf_parse_options(char *options, struct udf_options *uopt) uopt->gid = simple_strtoul(val, NULL, 0); else if (!strcmp(opt, "umask") && val) uopt->umask = simple_strtoul(val, NULL, 0); - else if (!strcmp(opt, "strict") && !val) - uopt->flags |= (1 << UDF_FLAG_STRICT); + else if (!strcmp(opt, "nostrict") && !val) + uopt->flags &= ~(1 << UDF_FLAG_STRICT); else if (!strcmp(opt, "uid") && val) uopt->uid = simple_strtoul(val, NULL, 0); else if (!strcmp(opt, "session") && val) @@ -496,72 +496,36 @@ udf_vrs(struct super_block *sb, int silent) * July 1, 1997 - Andrew E. Mileski * Written, tested, and released. */ -static int -udf_find_anchor(struct super_block *sb, int useranchor, int lastblock) +static void +udf_find_anchor(struct super_block *sb) { - int varlastblock = udf_variable_to_fixed(lastblock); - int last[] = { lastblock, lastblock - 2, - lastblock - 150, lastblock - 152, - varlastblock, varlastblock - 2, - varlastblock - 150, varlastblock - 152 }; + int lastblock = UDF_SB_LASTBLOCK(sb); struct buffer_head *bh = NULL; Uint16 ident; Uint32 location; int i; - UDF_SB_ANCHOR(sb)[0] = 0; - UDF_SB_ANCHOR(sb)[1] = 0; - UDF_SB_ANCHOR(sb)[2] = 0; - UDF_SB_ANCHOR(sb)[3] = 256 + UDF_SB_SESSION(sb); + if (lastblock) + { + int varlastblock = udf_variable_to_fixed(lastblock); + int last[] = { lastblock, lastblock - 2, + lastblock - 150, lastblock - 152, + varlastblock, varlastblock - 2, + varlastblock - 150, varlastblock - 152 }; - lastblock = 0; + lastblock = 0; - /* Search for an anchor volume descriptor pointer */ + /* Search for an anchor volume descriptor pointer */ - /* according to spec, anchor is in either: - * block 256 - * lastblock-256 - * lastblock - * however, if the disc isn't closed, it could be 512 */ + /* according to spec, anchor is in either: + * block 256 + * lastblock-256 + * lastblock + * however, if the disc isn't closed, it could be 512 */ - for (i=0; (!lastblock && i<sizeof(last)/sizeof(int)); i++) - { - if (last[i] < 0 || !(bh = bread(sb->s_dev, last[i], sb->s_blocksize))) - { - ident = location = 0; - } - else + for (i=0; (!lastblock && i<sizeof(last)/sizeof(int)); i++) { - ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); - location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); - udf_release_data(bh); - } - - if (ident == TID_ANCHOR_VOL_DESC_PTR) - { - if (location == last[i] - UDF_SB_SESSION(sb)) - { - lastblock = UDF_SB_ANCHOR(sb)[0] = last[i]; - UDF_SB_ANCHOR(sb)[1] = last[i] - 256; - } - else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) - { - UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); - lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]); - UDF_SB_ANCHOR(sb)[1] = lastblock - 256; - } - else - udf_debug("Anchor found at block %d, location mismatch %d.\n", - last[i], location); - } - else if (ident == TID_FILE_ENTRY || ident == TID_EXTENDED_FILE_ENTRY) - { - lastblock = last[i]; - UDF_SB_ANCHOR(sb)[2] = 512 + UDF_SB_SESSION(sb); - } - else - { - if (!(bh = bread(sb->s_dev, last[i] - 256, sb->s_blocksize))) + if (last[i] < 0 || !(bh = bread(sb->s_dev, last[i], sb->s_blocksize))) { ident = location = 0; } @@ -571,17 +535,32 @@ udf_find_anchor(struct super_block *sb, int useranchor, int lastblock) location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); udf_release_data(bh); } - - if (ident == TID_ANCHOR_VOL_DESC_PTR && - location == last[i] - 256 - UDF_SB_SESSION(sb)) + + if (ident == TID_ANCHOR_VOL_DESC_PTR) + { + if (location == last[i] - UDF_SB_SESSION(sb)) + { + lastblock = UDF_SB_ANCHOR(sb)[0] = last[i]; + UDF_SB_ANCHOR(sb)[1] = last[i] - 256; + } + else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) + { + UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); + lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]); + UDF_SB_ANCHOR(sb)[1] = lastblock - 256; + } + else + udf_debug("Anchor found at block %d, location mismatch %d.\n", + last[i], location); + } + else if (ident == TID_FILE_ENTRY || ident == TID_EXTENDED_FILE_ENTRY) { lastblock = last[i]; - UDF_SB_ANCHOR(sb)[1] = last[i] - 256; + UDF_SB_ANCHOR(sb)[3] = 512 + UDF_SB_SESSION(sb); } else { - if (!(bh = bread(sb->s_dev, last[i] - 312 - UDF_SB_SESSION(sb), - sb->s_blocksize))) + if (last[i] < 256 || !(bh = bread(sb->s_dev, last[i] - 256, sb->s_blocksize))) { ident = location = 0; } @@ -591,13 +570,34 @@ udf_find_anchor(struct super_block *sb, int useranchor, int lastblock) location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); udf_release_data(bh); } - + if (ident == TID_ANCHOR_VOL_DESC_PTR && - location == udf_variable_to_fixed(last[i]) - 256) + location == last[i] - 256 - UDF_SB_SESSION(sb)) { - UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); - lastblock = udf_variable_to_fixed(last[i]); - UDF_SB_ANCHOR(sb)[1] = lastblock - 256; + lastblock = last[i]; + UDF_SB_ANCHOR(sb)[1] = last[i] - 256; + } + else + { + if (last[i] < 312 + UDF_SB_SESSION(sb) || !(bh = bread(sb->s_dev, last[i] - 312 - UDF_SB_SESSION(sb), + sb->s_blocksize))) + { + ident = location = 0; + } + else + { + ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); + location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); + udf_release_data(bh); + } + + if (ident == TID_ANCHOR_VOL_DESC_PTR && + location == udf_variable_to_fixed(last[i]) - 256) + { + UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); + lastblock = udf_variable_to_fixed(last[i]); + UDF_SB_ANCHOR(sb)[1] = lastblock - 256; + } } } } @@ -636,15 +636,9 @@ udf_find_anchor(struct super_block *sb, int useranchor, int lastblock) } } } - else if (useranchor != 0xFFFFFFFF) - { - UDF_SB_ANCHOR(sb)[i] = useranchor; - useranchor = 0xFFFFFFFF; - i --; - } } - return lastblock; + UDF_SB_LASTBLOCK(sb) = lastblock; } static int @@ -985,8 +979,10 @@ udf_load_logicalvolint(struct super_block *sb, extent_ad loc) struct buffer_head *bh = NULL; Uint16 ident; - while ((bh = udf_read_tagged(sb, loc.extLocation, loc.extLocation, &ident)) && - ident == TID_LOGICAL_VOL_INTEGRITY_DESC && loc.extLength > 0) + while (loc.extLength > 0 && + (bh = udf_read_tagged(sb, loc.extLocation, + loc.extLocation, &ident)) && + ident == TID_LOGICAL_VOL_INTEGRITY_DESC) { UDF_SB_LVIDBH(sb) = bh; @@ -1152,6 +1148,8 @@ udf_check_valid(struct super_block *sb, int novrs, int silent) else if ((block = udf_vrs(sb, silent)) == -1) { udf_debug("Failed to read byte 32768. Assuming open disc. Skipping validity check\n"); + if (!UDF_SB_LASTBLOCK(sb)) + UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); return 0; } else @@ -1220,6 +1218,12 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset) if (!UDF_SB_LASTBLOCK(sb)) { + UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); + udf_find_anchor(sb); + } + + if (!UDF_SB_LASTBLOCK(sb)) + { udf_debug("Unable to determine Lastblock (For Virtual Partition)\n"); return 1; } @@ -1355,7 +1359,7 @@ udf_read_super(struct super_block *sb, void *options, int silent) struct udf_options uopt; lb_addr rootdir, fileset; - uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB); + uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); uopt.uid = -1; uopt.gid = -1; uopt.umask = 0; @@ -1409,14 +1413,10 @@ udf_read_super(struct super_block *sb, void *options, int silent) udf_debug("Multi-session=%d\n", UDF_SB_SESSION(sb)); - if ( uopt.lastblock == 0xFFFFFFFF ) - UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); - else - UDF_SB_LASTBLOCK(sb) = uopt.lastblock; - - UDF_SB_LASTBLOCK(sb) = udf_find_anchor(sb, uopt.anchor, UDF_SB_LASTBLOCK(sb)); - - udf_debug("Lastblock=%d\n", UDF_SB_LASTBLOCK(sb)); + UDF_SB_LASTBLOCK(sb) = uopt.lastblock; + UDF_SB_ANCHOR(sb)[0] = UDF_SB_ANCHOR(sb)[1] = 0; + UDF_SB_ANCHOR(sb)[2] = uopt.anchor; + UDF_SB_ANCHOR(sb)[3] = UDF_SB_SESSION(sb) + 256; if (udf_check_valid(sb, uopt.novrs, silent)) /* read volume recognition sequences */ { @@ -1424,6 +1424,8 @@ udf_read_super(struct super_block *sb, void *options, int silent) goto error_out; } + udf_find_anchor(sb); + /* Fill in the rest of the superblock */ sb->s_op = &udf_sb_ops; sb->dq_op = NULL; @@ -1436,6 +1438,8 @@ udf_read_super(struct super_block *sb, void *options, int silent) goto error_out; } + udf_debug("Lastblock=%d\n", UDF_SB_LASTBLOCK(sb)); + if ( UDF_SB_LVIDBH(sb) ) { Uint16 minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev); @@ -1744,7 +1748,7 @@ udf_count_free_table(struct super_block *sb, struct inode * table) unsigned int accum = 0; Uint32 extoffset, elen; lb_addr bloc, eloc; - char etype; + Sint8 etype; struct buffer_head *bh = NULL; bloc = UDF_I_LOCATION(table); @@ -1763,6 +1767,20 @@ udf_count_free(struct super_block *sb) { unsigned int accum = 0; + if (UDF_SB_LVIDBH(sb)) + { + if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > UDF_SB_PARTITION(sb)) + { + accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)]); + + if (accum == 0xFFFFFFFF) + accum = 0; + } + } + + if (accum) + return accum; + if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) { accum += udf_count_free_bitmap(sb, @@ -1786,18 +1804,6 @@ udf_count_free(struct super_block *sb) accum += udf_count_free_table(sb, UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table); } - if (accum) - return accum; - if (UDF_SB_LVIDBH(sb)) - { - if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > UDF_SB_PARTITION(sb)) - { - accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)]); - - if (accum == 0xFFFFFFFF) - accum = 0; - } - } return accum; } diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index 2f0c09534fc1..72878e5334e9 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -33,10 +33,9 @@ #include "udf_sb.h" static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset, - lb_addr eloc, Uint8 etype, Uint32 elen, struct buffer_head *bh, Uint32 nelen) + lb_addr eloc, Sint8 etype, Uint32 elen, struct buffer_head *bh, Uint32 nelen) { lb_addr neloc = { 0, 0 }; - int blocks = inode->i_sb->s_blocksize / 512; int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; int first_block = (nelen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; @@ -52,12 +51,10 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset, if (last_block - first_block > 0) { if (etype == EXTENT_RECORDED_ALLOCATED) - { - inode->i_blocks -= (blocks * (last_block - first_block)); mark_inode_dirty(inode); - } + if (etype != EXTENT_NOT_RECORDED_NOT_ALLOCATED) - udf_free_blocks(inode, eloc, first_block, last_block - first_block); + udf_free_blocks(inode->i_sb, inode, eloc, first_block, last_block - first_block); } } } @@ -66,7 +63,7 @@ void udf_truncate_extents(struct inode * inode) { lb_addr bloc, eloc, neloc = { 0, 0 }; Uint32 extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc; - int etype; + Sint8 etype; int first_block = inode->i_size >> inode->i_sb->s_blocksize_bits; struct buffer_head *bh = NULL; int adsize; @@ -108,7 +105,7 @@ void udf_truncate_extents(struct inode * inode) memset(bh->b_data, 0x00, udf_file_entry_alloc_offset(inode)); else memset(bh->b_data, 0x00, sizeof(struct AllocExtDesc)); - udf_free_blocks(inode, bloc, 0, lelen); + udf_free_blocks(inode->i_sb, inode, bloc, 0, lelen); } else { @@ -153,7 +150,7 @@ void udf_truncate_extents(struct inode * inode) memset(bh->b_data, 0x00, udf_file_entry_alloc_offset(inode)); else memset(bh->b_data, 0x00, sizeof(struct AllocExtDesc)); - udf_free_blocks(inode, bloc, 0, lelen); + udf_free_blocks(inode->i_sb, inode, bloc, 0, lelen); } else { diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index d13911aa76c4..ac4539946a29 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -11,7 +11,6 @@ #include <linux/config.h> #include <linux/types.h> - #include <linux/fs.h> #if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE) @@ -129,13 +128,13 @@ extern void udf_put_inode(struct inode *); extern void udf_delete_inode(struct inode *); extern void udf_write_inode(struct inode *, int); extern long udf_block_map(struct inode *, long); -extern int inode_bmap(struct inode *, int, lb_addr *, Uint32 *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **); -extern int udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, Uint32, struct buffer_head **, int); -extern int udf_write_aext(struct inode *, lb_addr, int *, lb_addr, Uint32, struct buffer_head *, int); -extern int udf_insert_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); -extern int udf_delete_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); -extern int udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); -extern int udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); +extern Sint8 inode_bmap(struct inode *, int, lb_addr *, Uint32 *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **); +extern Sint8 udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, Uint32, struct buffer_head **, int); +extern Sint8 udf_write_aext(struct inode *, lb_addr, int *, lb_addr, Uint32, struct buffer_head *, int); +extern Sint8 udf_insert_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); +extern Sint8 udf_delete_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *); +extern Sint8 udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); +extern Sint8 udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int); extern void udf_discard_prealloc(struct inode *); /* misc.c */ @@ -171,9 +170,9 @@ extern struct inode * udf_new_inode (struct inode *, int, int *); extern void udf_truncate_extents(struct inode *); /* balloc.c */ -extern void udf_free_blocks(struct inode *, lb_addr, Uint32, Uint32); -extern int udf_prealloc_blocks(struct inode *, Uint16, Uint32, Uint32); -extern int udf_new_block(struct inode *, Uint16, Uint32, int *); +extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, Uint32, Uint32); +extern int udf_prealloc_blocks(struct super_block *, struct inode *, Uint16, Uint32, Uint32); +extern int udf_new_block(struct super_block *, struct inode *, Uint16, Uint32, int *); /* fsync.c */ extern int udf_fsync_file(struct file *, struct dentry *, int); |
