aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2005-06-02 13:12:57 -0400
committerDave Kleikamp <shaggy@austin.ibm.com>2005-06-02 13:12:57 -0400
commit7078253c085c037c070ca4e8bc9e9e7f18aa1e84 (patch)
treeeaf56c1a77b0de6ee82e23cee4433b2c4a47e67e /fs
parent259692bd5a2b2c2d351dd90748ba4126bc2a21b9 (diff)
parent1e86d1c648508fd50e6c9960576b87906a7906ad (diff)
Merge with /home/shaggy/git/linus-clean/
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bad_inode.c2
-rw-r--r--fs/binfmt_elf.c4
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/buffer.c28
-rw-r--r--fs/char_dev.c2
-rw-r--r--fs/cifs/README10
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/cifssmb.c56
-rw-r--r--fs/cifs/dir.c3
-rw-r--r--fs/cifs/inode.c24
-rw-r--r--fs/cifs/misc.c1
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/eventpoll.c2
-rw-r--r--fs/exec.c7
-rw-r--r--fs/ext3/inode.c46
-rw-r--r--fs/ext3/super.c10
-rw-r--r--fs/hostfs/hostfs_kern.c11
-rw-r--r--fs/inode.c23
-rw-r--r--fs/jffs2/compr_rubin.c18
-rw-r--r--fs/jffs2/compr_zlib.c12
-rw-r--r--fs/locks.c6
-rw-r--r--fs/mbcache.c2
-rw-r--r--fs/mpage.c14
-rw-r--r--fs/namei.c9
-rw-r--r--fs/nfs/idmap.c4
-rw-r--r--fs/nfs/inode.c4
-rw-r--r--fs/nls/nls_base.c2
-rw-r--r--fs/partitions/msdos.c5
-rw-r--r--fs/proc/mmu.c14
-rw-r--r--fs/proc/proc_devtree.c105
-rw-r--r--fs/reiserfs/namei.c2
-rw-r--r--fs/reiserfs/stree.c1
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--fs/select.c6
-rw-r--r--fs/udf/udftime.c4
-rw-r--r--fs/xfs/Makefile2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c80
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c50
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c29
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.h6
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h10
-rw-r--r--fs/xfs/xfs_dfrag.c2
-rw-r--r--fs/xfs/xfs_iget.c51
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode.h6
-rw-r--r--fs/xfs/xfs_iomap.c30
-rw-r--r--fs/xfs/xfs_iomap.h25
-rw-r--r--fs/xfs/xfs_mount.c9
-rw-r--r--fs/xfs/xfs_mount.h19
-rw-r--r--fs/xfs/xfs_types.h1
-rw-r--r--fs/xfs/xfs_utils.c2
-rw-r--r--fs/xfs/xfs_utils.h2
-rw-r--r--fs/xfs/xfs_vfsops.c67
-rw-r--r--fs/xfs/xfs_vnodeops.c11
58 files changed, 489 insertions, 384 deletions
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 672a31924f3c..e172180a1d8c 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -47,7 +47,7 @@ static struct file_operations bad_file_ops =
47 .get_unmapped_area = EIO_ERROR, 47 .get_unmapped_area = EIO_ERROR,
48}; 48};
49 49
50struct inode_operations bad_inode_ops = 50static struct inode_operations bad_inode_ops =
51{ 51{
52 .create = EIO_ERROR, 52 .create = EIO_ERROR,
53 .lookup = EIO_ERROR, 53 .lookup = EIO_ERROR,
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index ce9423bb2de3..c374be51b041 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -251,7 +251,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
251 } 251 }
252 252
253 /* Populate argv and envp */ 253 /* Populate argv and envp */
254 p = current->mm->arg_start; 254 p = current->mm->arg_end = current->mm->arg_start;
255 while (argc-- > 0) { 255 while (argc-- > 0) {
256 size_t len; 256 size_t len;
257 __put_user((elf_addr_t)p, argv++); 257 __put_user((elf_addr_t)p, argv++);
@@ -1301,7 +1301,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1301static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, 1301static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1302 struct mm_struct *mm) 1302 struct mm_struct *mm)
1303{ 1303{
1304 int i, len; 1304 unsigned int i, len;
1305 1305
1306 /* first copy the parameters from user space */ 1306 /* first copy the parameters from user space */
1307 memset(psinfo, 0, sizeof(struct elf_prpsinfo)); 1307 memset(psinfo, 0, sizeof(struct elf_prpsinfo));
diff --git a/fs/block_dev.c b/fs/block_dev.c
index d19d07c49ad3..c0cbd1bc1a02 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -530,7 +530,7 @@ int check_disk_change(struct block_device *bdev)
530 if (!bdops->media_changed(bdev->bd_disk)) 530 if (!bdops->media_changed(bdev->bd_disk))
531 return 0; 531 return 0;
532 532
533 if (__invalidate_device(bdev, 0)) 533 if (__invalidate_device(bdev))
534 printk("VFS: busy inodes on changed media.\n"); 534 printk("VFS: busy inodes on changed media.\n");
535 535
536 if (bdops->revalidate_disk) 536 if (bdops->revalidate_disk)
diff --git a/fs/buffer.c b/fs/buffer.c
index 5f525b3c6d9f..7e9e409feaa7 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1210,7 +1210,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
1210 return 1; 1210 return 1;
1211} 1211}
1212 1212
1213struct buffer_head * 1213static struct buffer_head *
1214__getblk_slow(struct block_device *bdev, sector_t block, int size) 1214__getblk_slow(struct block_device *bdev, sector_t block, int size)
1215{ 1215{
1216 /* Size must be multiple of hard sectorsize */ 1216 /* Size must be multiple of hard sectorsize */
@@ -1809,7 +1809,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1809 } while (bh != head); 1809 } while (bh != head);
1810 1810
1811 do { 1811 do {
1812 get_bh(bh);
1813 if (!buffer_mapped(bh)) 1812 if (!buffer_mapped(bh))
1814 continue; 1813 continue;
1815 /* 1814 /*
@@ -1838,7 +1837,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1838 */ 1837 */
1839 BUG_ON(PageWriteback(page)); 1838 BUG_ON(PageWriteback(page));
1840 set_page_writeback(page); 1839 set_page_writeback(page);
1841 unlock_page(page);
1842 1840
1843 do { 1841 do {
1844 struct buffer_head *next = bh->b_this_page; 1842 struct buffer_head *next = bh->b_this_page;
@@ -1846,9 +1844,9 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1846 submit_bh(WRITE, bh); 1844 submit_bh(WRITE, bh);
1847 nr_underway++; 1845 nr_underway++;
1848 } 1846 }
1849 put_bh(bh);
1850 bh = next; 1847 bh = next;
1851 } while (bh != head); 1848 } while (bh != head);
1849 unlock_page(page);
1852 1850
1853 err = 0; 1851 err = 0;
1854done: 1852done:
@@ -1887,7 +1885,6 @@ recover:
1887 bh = head; 1885 bh = head;
1888 /* Recovery: lock and submit the mapped buffers */ 1886 /* Recovery: lock and submit the mapped buffers */
1889 do { 1887 do {
1890 get_bh(bh);
1891 if (buffer_mapped(bh) && buffer_dirty(bh)) { 1888 if (buffer_mapped(bh) && buffer_dirty(bh)) {
1892 lock_buffer(bh); 1889 lock_buffer(bh);
1893 mark_buffer_async_write(bh); 1890 mark_buffer_async_write(bh);
@@ -1910,7 +1907,6 @@ recover:
1910 submit_bh(WRITE, bh); 1907 submit_bh(WRITE, bh);
1911 nr_underway++; 1908 nr_underway++;
1912 } 1909 }
1913 put_bh(bh);
1914 bh = next; 1910 bh = next;
1915 } while (bh != head); 1911 } while (bh != head);
1916 goto done; 1912 goto done;
@@ -1953,7 +1949,7 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
1953 if (!buffer_mapped(bh)) { 1949 if (!buffer_mapped(bh)) {
1954 err = get_block(inode, block, bh, 1); 1950 err = get_block(inode, block, bh, 1);
1955 if (err) 1951 if (err)
1956 goto out; 1952 break;
1957 if (buffer_new(bh)) { 1953 if (buffer_new(bh)) {
1958 clear_buffer_new(bh); 1954 clear_buffer_new(bh);
1959 unmap_underlying_metadata(bh->b_bdev, 1955 unmap_underlying_metadata(bh->b_bdev,
@@ -1995,10 +1991,12 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
1995 while(wait_bh > wait) { 1991 while(wait_bh > wait) {
1996 wait_on_buffer(*--wait_bh); 1992 wait_on_buffer(*--wait_bh);
1997 if (!buffer_uptodate(*wait_bh)) 1993 if (!buffer_uptodate(*wait_bh))
1998 return -EIO; 1994 err = -EIO;
1999 } 1995 }
2000 return 0; 1996 if (!err)
2001out: 1997 return err;
1998
1999 /* Error case: */
2002 /* 2000 /*
2003 * Zero out any newly allocated blocks to avoid exposing stale 2001 * Zero out any newly allocated blocks to avoid exposing stale
2004 * data. If BH_New is set, we know that the block was newly 2002 * data. If BH_New is set, we know that the block was newly
@@ -2096,9 +2094,12 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
2096 continue; 2094 continue;
2097 2095
2098 if (!buffer_mapped(bh)) { 2096 if (!buffer_mapped(bh)) {
2097 int err = 0;
2098
2099 fully_mapped = 0; 2099 fully_mapped = 0;
2100 if (iblock < lblock) { 2100 if (iblock < lblock) {
2101 if (get_block(inode, iblock, bh, 0)) 2101 err = get_block(inode, iblock, bh, 0);
2102 if (err)
2102 SetPageError(page); 2103 SetPageError(page);
2103 } 2104 }
2104 if (!buffer_mapped(bh)) { 2105 if (!buffer_mapped(bh)) {
@@ -2106,7 +2107,8 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
2106 memset(kaddr + i * blocksize, 0, blocksize); 2107 memset(kaddr + i * blocksize, 0, blocksize);
2107 flush_dcache_page(page); 2108 flush_dcache_page(page);
2108 kunmap_atomic(kaddr, KM_USER0); 2109 kunmap_atomic(kaddr, KM_USER0);
2109 set_buffer_uptodate(bh); 2110 if (!err)
2111 set_buffer_uptodate(bh);
2110 continue; 2112 continue;
2111 } 2113 }
2112 /* 2114 /*
@@ -3115,7 +3117,7 @@ void __init buffer_init(void)
3115 3117
3116 bh_cachep = kmem_cache_create("buffer_head", 3118 bh_cachep = kmem_cache_create("buffer_head",
3117 sizeof(struct buffer_head), 0, 3119 sizeof(struct buffer_head), 0,
3118 SLAB_PANIC, init_buffer_head, NULL); 3120 SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_buffer_head, NULL);
3119 3121
3120 /* 3122 /*
3121 * Limit the bh occupancy to 10% of ZONE_NORMAL 3123 * Limit the bh occupancy to 10% of ZONE_NORMAL
diff --git a/fs/char_dev.c b/fs/char_dev.c
index a745b1d9e545..c1e3537909fc 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -328,7 +328,7 @@ void cd_forget(struct inode *inode)
328 spin_unlock(&cdev_lock); 328 spin_unlock(&cdev_lock);
329} 329}
330 330
331void cdev_purge(struct cdev *cdev) 331static void cdev_purge(struct cdev *cdev)
332{ 332{
333 spin_lock(&cdev_lock); 333 spin_lock(&cdev_lock);
334 while (!list_empty(&cdev->list)) { 334 while (!list_empty(&cdev->list)) {
diff --git a/fs/cifs/README b/fs/cifs/README
index 7b4ac096cd11..34b0cf7111f3 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -32,9 +32,9 @@ the cifs download to your kernel build directory e.g.
326) make modules (or "make" if CIFS VFS not to be built as a module) 326) make modules (or "make" if CIFS VFS not to be built as a module)
33 33
34For Linux 2.6: 34For Linux 2.6:
351) Download the kernel (e.g. from http://www.kernel.org or from bitkeeper 351) Download the kernel (e.g. from http://www.kernel.org)
36at bk://linux.bkbits.net/linux-2.5) and change directory into the top 36and change directory into the top of the kernel directory tree
37of the kernel directory tree (e.g. /usr/src/linux-2.5.73) 37(e.g. /usr/src/linux-2.5.73)
382) make menuconfig (or make xconfig) 382) make menuconfig (or make xconfig)
393) select cifs from within the network filesystem choices 393) select cifs from within the network filesystem choices
404) save and exit 404) save and exit
@@ -371,7 +371,7 @@ A partial list of the supported mount options follows:
371 on newly created files, directories, and devices (create, 371 on newly created files, directories, and devices (create,
372 mkdir, mknod) which will result in the server setting the 372 mkdir, mknod) which will result in the server setting the
373 uid and gid to the default (usually the server uid of the 373 uid and gid to the default (usually the server uid of the
374 usern who mounted the share). Letting the server (rather than 374 user who mounted the share). Letting the server (rather than
375 the client) set the uid and gid is the default. This 375 the client) set the uid and gid is the default. This
376 parameter has no effect if the CIFS Unix Extensions are not 376 parameter has no effect if the CIFS Unix Extensions are not
377 negotiated. 377 negotiated.
@@ -384,7 +384,7 @@ A partial list of the supported mount options follows:
384 client (e.g. when the application is doing large sequential 384 client (e.g. when the application is doing large sequential
385 reads bigger than page size without rereading the same data) 385 reads bigger than page size without rereading the same data)
386 this can provide better performance than the default 386 this can provide better performance than the default
387 behavior which caches reads (reaadahead) and writes 387 behavior which caches reads (readahead) and writes
388 (writebehind) through the local Linux client pagecache 388 (writebehind) through the local Linux client pagecache
389 if oplock (caching token) is granted and held. Note that 389 if oplock (caching token) is granted and held. Note that
390 direct allows write operations larger than page size 390 direct allows write operations larger than page size
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 0010511083fc..ea239dea571e 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -228,7 +228,7 @@ extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
228 const struct nls_table *nls_codepage, 228 const struct nls_table *nls_codepage,
229 int remap_special_chars); 229 int remap_special_chars);
230#endif /* CONFIG_CIFS_EXPERIMENTAL */ 230#endif /* CONFIG_CIFS_EXPERIMENTAL */
231extern int cifs_convertUCSpath(char *target, const __u16 *source, int maxlen, 231extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
232 const struct nls_table * codepage); 232 const struct nls_table * codepage);
233extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen, 233extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
234 const struct nls_table * cp, int mapChars); 234 const struct nls_table * cp, int mapChars);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 741ff0c69f37..3c628bf667a5 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -567,7 +567,7 @@ DelFileRetry:
567 567
568 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 568 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
569 name_len = 569 name_len =
570 cifsConvertToUCS((__u16 *) pSMB->fileName, fileName, 570 cifsConvertToUCS((__le16 *) pSMB->fileName, fileName,
571 PATH_MAX, nls_codepage, remap); 571 PATH_MAX, nls_codepage, remap);
572 name_len++; /* trailing null */ 572 name_len++; /* trailing null */
573 name_len *= 2; 573 name_len *= 2;
@@ -665,7 +665,7 @@ MkDirRetry:
665 return rc; 665 return rc;
666 666
667 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 667 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
668 name_len = cifsConvertToUCS((__u16 *) pSMB->DirName, name, 668 name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, name,
669 PATH_MAX, nls_codepage, remap); 669 PATH_MAX, nls_codepage, remap);
670 name_len++; /* trailing null */ 670 name_len++; /* trailing null */
671 name_len *= 2; 671 name_len *= 2;
@@ -719,7 +719,7 @@ openRetry:
719 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 719 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
720 count = 1; /* account for one byte pad to word boundary */ 720 count = 1; /* account for one byte pad to word boundary */
721 name_len = 721 name_len =
722 cifsConvertToUCS((__u16 *) (pSMB->fileName + 1), 722 cifsConvertToUCS((__le16 *) (pSMB->fileName + 1),
723 fileName, PATH_MAX, nls_codepage, remap); 723 fileName, PATH_MAX, nls_codepage, remap);
724 name_len++; /* trailing null */ 724 name_len++; /* trailing null */
725 name_len *= 2; 725 name_len *= 2;
@@ -1141,7 +1141,7 @@ renameRetry:
1141 1141
1142 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1142 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1143 name_len = 1143 name_len =
1144 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName, 1144 cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName,
1145 PATH_MAX, nls_codepage, remap); 1145 PATH_MAX, nls_codepage, remap);
1146 name_len++; /* trailing null */ 1146 name_len++; /* trailing null */
1147 name_len *= 2; 1147 name_len *= 2;
@@ -1149,7 +1149,7 @@ renameRetry:
1149 /* protocol requires ASCII signature byte on Unicode string */ 1149 /* protocol requires ASCII signature byte on Unicode string */
1150 pSMB->OldFileName[name_len + 1] = 0x00; 1150 pSMB->OldFileName[name_len + 1] = 0x00;
1151 name_len2 = 1151 name_len2 =
1152 cifsConvertToUCS((__u16 *) &pSMB->OldFileName[name_len + 2], 1152 cifsConvertToUCS((__le16 *) &pSMB->OldFileName[name_len + 2],
1153 toName, PATH_MAX, nls_codepage, remap); 1153 toName, PATH_MAX, nls_codepage, remap);
1154 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1154 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1155 name_len2 *= 2; /* convert to bytes */ 1155 name_len2 *= 2; /* convert to bytes */
@@ -1236,10 +1236,10 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1236 /* unicode only call */ 1236 /* unicode only call */
1237 if(target_name == NULL) { 1237 if(target_name == NULL) {
1238 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); 1238 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid);
1239 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name, 1239 len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name,
1240 dummy_string, 24, nls_codepage, remap); 1240 dummy_string, 24, nls_codepage, remap);
1241 } else { 1241 } else {
1242 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name, 1242 len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name,
1243 target_name, PATH_MAX, nls_codepage, remap); 1243 target_name, PATH_MAX, nls_codepage, remap);
1244 } 1244 }
1245 rename_info->target_name_len = cpu_to_le32(2 * len_of_str); 1245 rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
@@ -1296,7 +1296,7 @@ copyRetry:
1296 pSMB->Flags = cpu_to_le16(flags & COPY_TREE); 1296 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
1297 1297
1298 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1298 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1299 name_len = cifsConvertToUCS((__u16 *) pSMB->OldFileName, 1299 name_len = cifsConvertToUCS((__le16 *) pSMB->OldFileName,
1300 fromName, PATH_MAX, nls_codepage, 1300 fromName, PATH_MAX, nls_codepage,
1301 remap); 1301 remap);
1302 name_len++; /* trailing null */ 1302 name_len++; /* trailing null */
@@ -1304,7 +1304,7 @@ copyRetry:
1304 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1304 pSMB->OldFileName[name_len] = 0x04; /* pad */
1305 /* protocol requires ASCII signature byte on Unicode string */ 1305 /* protocol requires ASCII signature byte on Unicode string */
1306 pSMB->OldFileName[name_len + 1] = 0x00; 1306 pSMB->OldFileName[name_len + 1] = 0x00;
1307 name_len2 = cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2], 1307 name_len2 = cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
1308 toName, PATH_MAX, nls_codepage, remap); 1308 toName, PATH_MAX, nls_codepage, remap);
1309 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1309 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1310 name_len2 *= 2; /* convert to bytes */ 1310 name_len2 *= 2; /* convert to bytes */
@@ -1453,7 +1453,7 @@ createHardLinkRetry:
1453 return rc; 1453 return rc;
1454 1454
1455 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1455 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1456 name_len = cifsConvertToUCS((__u16 *) pSMB->FileName, toName, 1456 name_len = cifsConvertToUCS((__le16 *) pSMB->FileName, toName,
1457 PATH_MAX, nls_codepage, remap); 1457 PATH_MAX, nls_codepage, remap);
1458 name_len++; /* trailing null */ 1458 name_len++; /* trailing null */
1459 name_len *= 2; 1459 name_len *= 2;
@@ -1476,7 +1476,7 @@ createHardLinkRetry:
1476 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 1476 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
1477 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1477 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1478 name_len_target = 1478 name_len_target =
1479 cifsConvertToUCS((__u16 *) data_offset, fromName, PATH_MAX, 1479 cifsConvertToUCS((__le16 *) data_offset, fromName, PATH_MAX,
1480 nls_codepage, remap); 1480 nls_codepage, remap);
1481 name_len_target++; /* trailing null */ 1481 name_len_target++; /* trailing null */
1482 name_len_target *= 2; 1482 name_len_target *= 2;
@@ -1546,14 +1546,14 @@ winCreateHardLinkRetry:
1546 1546
1547 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1547 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1548 name_len = 1548 name_len =
1549 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName, 1549 cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName,
1550 PATH_MAX, nls_codepage, remap); 1550 PATH_MAX, nls_codepage, remap);
1551 name_len++; /* trailing null */ 1551 name_len++; /* trailing null */
1552 name_len *= 2; 1552 name_len *= 2;
1553 pSMB->OldFileName[name_len] = 0; /* pad */ 1553 pSMB->OldFileName[name_len] = 0; /* pad */
1554 pSMB->OldFileName[name_len + 1] = 0x04; 1554 pSMB->OldFileName[name_len + 1] = 0x04;
1555 name_len2 = 1555 name_len2 =
1556 cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2], 1556 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
1557 toName, PATH_MAX, nls_codepage, remap); 1557 toName, PATH_MAX, nls_codepage, remap);
1558 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1558 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1559 name_len2 *= 2; /* convert to bytes */ 1559 name_len2 *= 2; /* convert to bytes */
@@ -1939,7 +1939,7 @@ queryAclRetry:
1939 1939
1940 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1940 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1941 name_len = 1941 name_len =
1942 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 1942 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
1943 PATH_MAX, nls_codepage, remap); 1943 PATH_MAX, nls_codepage, remap);
1944 name_len++; /* trailing null */ 1944 name_len++; /* trailing null */
1945 name_len *= 2; 1945 name_len *= 2;
@@ -2024,7 +2024,7 @@ setAclRetry:
2024 return rc; 2024 return rc;
2025 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2025 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2026 name_len = 2026 name_len =
2027 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 2027 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
2028 PATH_MAX, nls_codepage, remap); 2028 PATH_MAX, nls_codepage, remap);
2029 name_len++; /* trailing null */ 2029 name_len++; /* trailing null */
2030 name_len *= 2; 2030 name_len *= 2;
@@ -2188,7 +2188,7 @@ QPathInfoRetry:
2188 2188
2189 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2189 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2190 name_len = 2190 name_len =
2191 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2191 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
2192 PATH_MAX, nls_codepage, remap); 2192 PATH_MAX, nls_codepage, remap);
2193 name_len++; /* trailing null */ 2193 name_len++; /* trailing null */
2194 name_len *= 2; 2194 name_len *= 2;
@@ -2269,7 +2269,7 @@ UnixQPathInfoRetry:
2269 2269
2270 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2270 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2271 name_len = 2271 name_len =
2272 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2272 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
2273 PATH_MAX, nls_codepage, remap); 2273 PATH_MAX, nls_codepage, remap);
2274 name_len++; /* trailing null */ 2274 name_len++; /* trailing null */
2275 name_len *= 2; 2275 name_len *= 2;
@@ -2350,7 +2350,7 @@ findUniqueRetry:
2350 2350
2351 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2351 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2352 name_len = 2352 name_len =
2353 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2353 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX
2354 /* find define for this maxpathcomponent */ 2354 /* find define for this maxpathcomponent */
2355 , nls_codepage); 2355 , nls_codepage);
2356 name_len++; /* trailing null */ 2356 name_len++; /* trailing null */
@@ -2435,7 +2435,7 @@ findFirstRetry:
2435 2435
2436 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2436 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2437 name_len = 2437 name_len =
2438 cifsConvertToUCS((__u16 *) pSMB->FileName,searchName, 2438 cifsConvertToUCS((__le16 *) pSMB->FileName,searchName,
2439 PATH_MAX, nls_codepage, remap); 2439 PATH_MAX, nls_codepage, remap);
2440 /* We can not add the asterik earlier in case 2440 /* We can not add the asterik earlier in case
2441 it got remapped to 0xF03A as if it were part of the 2441 it got remapped to 0xF03A as if it were part of the
@@ -2726,7 +2726,7 @@ GetInodeNumberRetry:
2726 2726
2727 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2727 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2728 name_len = 2728 name_len =
2729 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 2729 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
2730 PATH_MAX,nls_codepage, remap); 2730 PATH_MAX,nls_codepage, remap);
2731 name_len++; /* trailing null */ 2731 name_len++; /* trailing null */
2732 name_len *= 2; 2732 name_len *= 2;
@@ -2837,7 +2837,7 @@ getDFSRetry:
2837 if (ses->capabilities & CAP_UNICODE) { 2837 if (ses->capabilities & CAP_UNICODE) {
2838 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 2838 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
2839 name_len = 2839 name_len =
2840 cifsConvertToUCS((__u16 *) pSMB->RequestFileName, 2840 cifsConvertToUCS((__le16 *) pSMB->RequestFileName,
2841 searchName, PATH_MAX, nls_codepage, remap); 2841 searchName, PATH_MAX, nls_codepage, remap);
2842 name_len++; /* trailing null */ 2842 name_len++; /* trailing null */
2843 name_len *= 2; 2843 name_len *= 2;
@@ -3369,7 +3369,7 @@ SetEOFRetry:
3369 3369
3370 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3370 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3371 name_len = 3371 name_len =
3372 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3372 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
3373 PATH_MAX, nls_codepage, remap); 3373 PATH_MAX, nls_codepage, remap);
3374 name_len++; /* trailing null */ 3374 name_len++; /* trailing null */
3375 name_len *= 2; 3375 name_len *= 2;
@@ -3627,7 +3627,7 @@ SetTimesRetry:
3627 3627
3628 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3628 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3629 name_len = 3629 name_len =
3630 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3630 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
3631 PATH_MAX, nls_codepage, remap); 3631 PATH_MAX, nls_codepage, remap);
3632 name_len++; /* trailing null */ 3632 name_len++; /* trailing null */
3633 name_len *= 2; 3633 name_len *= 2;
@@ -3708,7 +3708,7 @@ SetAttrLgcyRetry:
3708 3708
3709 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3709 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3710 name_len = 3710 name_len =
3711 ConvertToUCS((wchar_t *) pSMB->fileName, fileName, 3711 ConvertToUCS((__le16 *) pSMB->fileName, fileName,
3712 PATH_MAX, nls_codepage); 3712 PATH_MAX, nls_codepage);
3713 name_len++; /* trailing null */ 3713 name_len++; /* trailing null */
3714 name_len *= 2; 3714 name_len *= 2;
@@ -3759,7 +3759,7 @@ setPermsRetry:
3759 3759
3760 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3760 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3761 name_len = 3761 name_len =
3762 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 3762 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
3763 PATH_MAX, nls_codepage, remap); 3763 PATH_MAX, nls_codepage, remap);
3764 name_len++; /* trailing null */ 3764 name_len++; /* trailing null */
3765 name_len *= 2; 3765 name_len *= 2;
@@ -3904,7 +3904,7 @@ QAllEAsRetry:
3904 3904
3905 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3905 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3906 name_len = 3906 name_len =
3907 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, 3907 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
3908 PATH_MAX, nls_codepage, remap); 3908 PATH_MAX, nls_codepage, remap);
3909 name_len++; /* trailing null */ 3909 name_len++; /* trailing null */
3910 name_len *= 2; 3910 name_len *= 2;
@@ -4047,7 +4047,7 @@ QEARetry:
4047 4047
4048 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4048 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4049 name_len = 4049 name_len =
4050 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName, 4050 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
4051 PATH_MAX, nls_codepage, remap); 4051 PATH_MAX, nls_codepage, remap);
4052 name_len++; /* trailing null */ 4052 name_len++; /* trailing null */
4053 name_len *= 2; 4053 name_len *= 2;
@@ -4194,7 +4194,7 @@ SetEARetry:
4194 4194
4195 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4195 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4196 name_len = 4196 name_len =
4197 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName, 4197 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName,
4198 PATH_MAX, nls_codepage, remap); 4198 PATH_MAX, nls_codepage, remap);
4199 name_len++; /* trailing null */ 4199 name_len++; /* trailing null */
4200 name_len *= 2; 4200 name_len *= 2;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index e3137aa48cdd..3f3538d4a1fa 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -392,7 +392,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
392 rc = 0; 392 rc = 0;
393 d_add(direntry, NULL); 393 d_add(direntry, NULL);
394 } else { 394 } else {
395 cERROR(1,("Error 0x%x or on cifs_get_inode_info in lookup",rc)); 395 cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s",
396 rc,full_path));
396 /* BB special case check for Access Denied - watch security 397 /* BB special case check for Access Denied - watch security
397 exposure of returning dir info implicitly via different rc 398 exposure of returning dir info implicitly via different rc
398 if file exists or not but no access BB */ 399 if file exists or not but no access BB */
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 670947288262..b8b78cbb34c9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -422,7 +422,8 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
423 423
424 if (!rc) { 424 if (!rc) {
425 direntry->d_inode->i_nlink--; 425 if(direntry->d_inode)
426 direntry->d_inode->i_nlink--;
426 } else if (rc == -ENOENT) { 427 } else if (rc == -ENOENT) {
427 d_drop(direntry); 428 d_drop(direntry);
428 } else if (rc == -ETXTBSY) { 429 } else if (rc == -ETXTBSY) {
@@ -440,7 +441,8 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
440 cifs_sb->mnt_cifs_flags & 441 cifs_sb->mnt_cifs_flags &
441 CIFS_MOUNT_MAP_SPECIAL_CHR); 442 CIFS_MOUNT_MAP_SPECIAL_CHR);
442 CIFSSMBClose(xid, pTcon, netfid); 443 CIFSSMBClose(xid, pTcon, netfid);
443 direntry->d_inode->i_nlink--; 444 if(direntry->d_inode)
445 direntry->d_inode->i_nlink--;
444 } 446 }
445 } else if (rc == -EACCES) { 447 } else if (rc == -EACCES) {
446 /* try only if r/o attribute set in local lookup data? */ 448 /* try only if r/o attribute set in local lookup data? */
@@ -494,7 +496,8 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
494 cifs_sb->mnt_cifs_flags & 496 cifs_sb->mnt_cifs_flags &
495 CIFS_MOUNT_MAP_SPECIAL_CHR); 497 CIFS_MOUNT_MAP_SPECIAL_CHR);
496 if (!rc) { 498 if (!rc) {
497 direntry->d_inode->i_nlink--; 499 if(direntry->d_inode)
500 direntry->d_inode->i_nlink--;
498 } else if (rc == -ETXTBSY) { 501 } else if (rc == -ETXTBSY) {
499 int oplock = FALSE; 502 int oplock = FALSE;
500 __u16 netfid; 503 __u16 netfid;
@@ -514,17 +517,20 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
514 cifs_sb->mnt_cifs_flags & 517 cifs_sb->mnt_cifs_flags &
515 CIFS_MOUNT_MAP_SPECIAL_CHR); 518 CIFS_MOUNT_MAP_SPECIAL_CHR);
516 CIFSSMBClose(xid, pTcon, netfid); 519 CIFSSMBClose(xid, pTcon, netfid);
517 direntry->d_inode->i_nlink--; 520 if(direntry->d_inode)
521 direntry->d_inode->i_nlink--;
518 } 522 }
519 /* BB if rc = -ETXTBUSY goto the rename logic BB */ 523 /* BB if rc = -ETXTBUSY goto the rename logic BB */
520 } 524 }
521 } 525 }
522 } 526 }
523 cifsInode = CIFS_I(direntry->d_inode); 527 if(direntry->d_inode) {
524 cifsInode->time = 0; /* will force revalidate to get info when 528 cifsInode = CIFS_I(direntry->d_inode);
525 needed */ 529 cifsInode->time = 0; /* will force revalidate to get info
526 direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = 530 when needed */
527 current_fs_time(inode->i_sb); 531 direntry->d_inode->i_ctime = current_fs_time(inode->i_sb);
532 }
533 inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
528 cifsInode = CIFS_I(inode); 534 cifsInode = CIFS_I(inode);
529 cifsInode->time = 0; /* force revalidate of dir as well */ 535 cifsInode->time = 0; /* force revalidate of dir as well */
530 536
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index db14b503d89e..072b4ee8c53e 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -571,6 +571,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen,
571 break; 571 break;
572 case UNI_LESSTHAN: 572 case UNI_LESSTHAN:
573 target[j] = '<'; 573 target[j] = '<';
574 break;
574 default: 575 default:
575 len = cp->uni2char(src_char, &target[j], 576 len = cp->uni2char(src_char, &target[j],
576 NLS_MAX_CHARSET_SIZE); 577 NLS_MAX_CHARSET_SIZE);
diff --git a/fs/dcache.c b/fs/dcache.c
index 496a4e08369c..3aa8a7e980d8 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -39,7 +39,7 @@ int sysctl_vfs_cache_pressure = 100;
39EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); 39EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
40 40
41 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock); 41 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock);
42seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED; 42static seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED;
43 43
44EXPORT_SYMBOL(dcache_lock); 44EXPORT_SYMBOL(dcache_lock);
45 45
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 05b966cd6f76..9900e333655a 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -320,7 +320,7 @@ static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type,
320/* 320/*
321 * This semaphore is used to serialize ep_free() and eventpoll_release_file(). 321 * This semaphore is used to serialize ep_free() and eventpoll_release_file().
322 */ 322 */
323struct semaphore epsem; 323static struct semaphore epsem;
324 324
325/* Safe wake up implementation */ 325/* Safe wake up implementation */
326static struct poll_safewake psw; 326static struct poll_safewake psw;
diff --git a/fs/exec.c b/fs/exec.c
index a8394499926c..e56ee2437025 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -197,7 +197,8 @@ static int count(char __user * __user * argv, int max)
197 * memory to free pages in kernel mem. These are in a format ready 197 * memory to free pages in kernel mem. These are in a format ready
198 * to be put directly into the top of new user memory. 198 * to be put directly into the top of new user memory.
199 */ 199 */
200int copy_strings(int argc,char __user * __user * argv, struct linux_binprm *bprm) 200static int copy_strings(int argc, char __user * __user * argv,
201 struct linux_binprm *bprm)
201{ 202{
202 struct page *kmapped_page = NULL; 203 struct page *kmapped_page = NULL;
203 char *kaddr = NULL; 204 char *kaddr = NULL;
@@ -868,9 +869,11 @@ int flush_old_exec(struct linux_binprm * bprm)
868 if (current->euid == current->uid && current->egid == current->gid) 869 if (current->euid == current->uid && current->egid == current->gid)
869 current->mm->dumpable = 1; 870 current->mm->dumpable = 1;
870 name = bprm->filename; 871 name = bprm->filename;
872
873 /* Copies the binary name from after last slash */
871 for (i=0; (ch = *(name++)) != '\0';) { 874 for (i=0; (ch = *(name++)) != '\0';) {
872 if (ch == '/') 875 if (ch == '/')
873 i = 0; 876 i = 0; /* overwrite what we wrote */
874 else 877 else
875 if (i < (sizeof(tcomm) - 1)) 878 if (i < (sizeof(tcomm) - 1))
876 tcomm[i++] = ch; 879 tcomm[i++] = ch;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index ea5888688f94..0d5fa73b18dc 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -844,12 +844,6 @@ get_block:
844 return ret; 844 return ret;
845} 845}
846 846
847static int ext3_writepages_get_block(struct inode *inode, sector_t iblock,
848 struct buffer_head *bh, int create)
849{
850 return ext3_direct_io_get_blocks(inode, iblock, 1, bh, create);
851}
852
853/* 847/*
854 * `handle' can be NULL if create is zero 848 * `handle' can be NULL if create is zero
855 */ 849 */
@@ -1323,45 +1317,6 @@ out_fail:
1323 return ret; 1317 return ret;
1324} 1318}
1325 1319
1326static int
1327ext3_writeback_writepage_helper(struct page *page,
1328 struct writeback_control *wbc)
1329{
1330 return block_write_full_page(page, ext3_get_block, wbc);
1331}
1332
1333static int
1334ext3_writeback_writepages(struct address_space *mapping,
1335 struct writeback_control *wbc)
1336{
1337 struct inode *inode = mapping->host;
1338 handle_t *handle = NULL;
1339 int err, ret = 0;
1340
1341 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
1342 return ret;
1343
1344 handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode));
1345 if (IS_ERR(handle)) {
1346 ret = PTR_ERR(handle);
1347 return ret;
1348 }
1349
1350 ret = __mpage_writepages(mapping, wbc, ext3_writepages_get_block,
1351 ext3_writeback_writepage_helper);
1352
1353 /*
1354 * Need to reaquire the handle since ext3_writepages_get_block()
1355 * can restart the handle
1356 */
1357 handle = journal_current_handle();
1358
1359 err = ext3_journal_stop(handle);
1360 if (!ret)
1361 ret = err;
1362 return ret;
1363}
1364
1365static int ext3_writeback_writepage(struct page *page, 1320static int ext3_writeback_writepage(struct page *page,
1366 struct writeback_control *wbc) 1321 struct writeback_control *wbc)
1367{ 1322{
@@ -1599,7 +1554,6 @@ static struct address_space_operations ext3_writeback_aops = {
1599 .readpage = ext3_readpage, 1554 .readpage = ext3_readpage,
1600 .readpages = ext3_readpages, 1555 .readpages = ext3_readpages,
1601 .writepage = ext3_writeback_writepage, 1556 .writepage = ext3_writeback_writepage,
1602 .writepages = ext3_writeback_writepages,
1603 .sync_page = block_sync_page, 1557 .sync_page = block_sync_page,
1604 .prepare_write = ext3_prepare_write, 1558 .prepare_write = ext3_prepare_write,
1605 .commit_write = ext3_writeback_commit_write, 1559 .commit_write = ext3_writeback_commit_write,
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 545b440a2d2f..981ccb233ef5 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -225,8 +225,16 @@ void __ext3_std_error (struct super_block * sb, const char * function,
225 int errno) 225 int errno)
226{ 226{
227 char nbuf[16]; 227 char nbuf[16];
228 const char *errstr = ext3_decode_error(sb, errno, nbuf); 228 const char *errstr;
229
230 /* Special case: if the error is EROFS, and we're not already
231 * inside a transaction, then there's really no point in logging
232 * an error. */
233 if (errno == -EROFS && journal_current_handle() == NULL &&
234 (sb->s_flags & MS_RDONLY))
235 return;
229 236
237 errstr = ext3_decode_error(sb, errno, nbuf);
230 printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n", 238 printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n",
231 sb->s_id, function, errstr); 239 sb->s_id, function, errstr);
232 240
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e6c63d9cac7b..4bf43ea87c46 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -23,7 +23,6 @@
23#include "kern_util.h" 23#include "kern_util.h"
24#include "kern.h" 24#include "kern.h"
25#include "user_util.h" 25#include "user_util.h"
26#include "2_5compat.h"
27#include "init.h" 26#include "init.h"
28 27
29struct hostfs_inode_info { 28struct hostfs_inode_info {
@@ -991,13 +990,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
991 goto out_put; 990 goto out_put;
992 991
993 err = read_inode(root_inode); 992 err = read_inode(root_inode);
994 if(err) 993 if(err){
995 goto out_put; 994 /* No iput in this case because the dput does that for us */
995 dput(sb->s_root);
996 sb->s_root = NULL;
997 goto out_free;
998 }
996 999
997 return(0); 1000 return(0);
998 1001
999 out_put: 1002 out_put:
1000 iput(root_inode); 1003 iput(root_inode);
1001 out_free: 1004 out_free:
1002 kfree(name); 1005 kfree(name);
1003 out: 1006 out:
diff --git a/fs/inode.c b/fs/inode.c
index af8fd78d2099..801fe7f36280 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -26,7 +26,6 @@
26 * This is needed for the following functions: 26 * This is needed for the following functions:
27 * - inode_has_buffers 27 * - inode_has_buffers
28 * - invalidate_inode_buffers 28 * - invalidate_inode_buffers
29 * - fsync_bdev
30 * - invalidate_bdev 29 * - invalidate_bdev
31 * 30 *
32 * FIXME: remove all knowledge of the buffer layer from this file 31 * FIXME: remove all knowledge of the buffer layer from this file
@@ -332,14 +331,6 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
332 return busy; 331 return busy;
333} 332}
334 333
335/*
336 * This is a two-stage process. First we collect all
337 * offending inodes onto the throw-away list, and in
338 * the second stage we actually dispose of them. This
339 * is because we don't want to sleep while messing
340 * with the global lists..
341 */
342
343/** 334/**
344 * invalidate_inodes - discard the inodes on a device 335 * invalidate_inodes - discard the inodes on a device
345 * @sb: superblock 336 * @sb: superblock
@@ -366,16 +357,11 @@ int invalidate_inodes(struct super_block * sb)
366 357
367EXPORT_SYMBOL(invalidate_inodes); 358EXPORT_SYMBOL(invalidate_inodes);
368 359
369int __invalidate_device(struct block_device *bdev, int do_sync) 360int __invalidate_device(struct block_device *bdev)
370{ 361{
371 struct super_block *sb; 362 struct super_block *sb = get_super(bdev);
372 int res; 363 int res = 0;
373 364
374 if (do_sync)
375 fsync_bdev(bdev);
376
377 res = 0;
378 sb = get_super(bdev);
379 if (sb) { 365 if (sb) {
380 /* 366 /*
381 * no need to lock the super, get_super holds the 367 * no need to lock the super, get_super holds the
@@ -390,7 +376,6 @@ int __invalidate_device(struct block_device *bdev, int do_sync)
390 invalidate_bdev(bdev, 0); 376 invalidate_bdev(bdev, 0);
391 return res; 377 return res;
392} 378}
393
394EXPORT_SYMBOL(__invalidate_device); 379EXPORT_SYMBOL(__invalidate_device);
395 380
396static int can_unuse(struct inode *inode) 381static int can_unuse(struct inode *inode)
@@ -1336,7 +1321,7 @@ void __init inode_init(unsigned long mempages)
1336 1321
1337 /* inode slab cache */ 1322 /* inode slab cache */
1338 inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode), 1323 inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
1339 0, SLAB_PANIC, init_once, NULL); 1324 0, SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_once, NULL);
1340 set_shrinker(DEFAULT_SEEKS, shrink_icache_memory); 1325 set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
1341 1326
1342 /* Hash may have been set up in inode_init_early */ 1327 /* Hash may have been set up in inode_init_early */
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
index 450d6624181f..09422388fb96 100644
--- a/fs/jffs2/compr_rubin.c
+++ b/fs/jffs2/compr_rubin.c
@@ -228,8 +228,10 @@ int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
228 return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); 228 return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
229} 229}
230#endif 230#endif
231int jffs2_dynrubin_compress(unsigned char *data_in, unsigned char *cpage_out, 231static int jffs2_dynrubin_compress(unsigned char *data_in,
232 uint32_t *sourcelen, uint32_t *dstlen, void *model) 232 unsigned char *cpage_out,
233 uint32_t *sourcelen, uint32_t *dstlen,
234 void *model)
233{ 235{
234 int bits[8]; 236 int bits[8];
235 unsigned char histo[256]; 237 unsigned char histo[256];
@@ -306,15 +308,19 @@ static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata
306} 308}
307 309
308 310
309int jffs2_rubinmips_decompress(unsigned char *data_in, unsigned char *cpage_out, 311static int jffs2_rubinmips_decompress(unsigned char *data_in,
310 uint32_t sourcelen, uint32_t dstlen, void *model) 312 unsigned char *cpage_out,
313 uint32_t sourcelen, uint32_t dstlen,
314 void *model)
311{ 315{
312 rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); 316 rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
313 return 0; 317 return 0;
314} 318}
315 319
316int jffs2_dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out, 320static int jffs2_dynrubin_decompress(unsigned char *data_in,
317 uint32_t sourcelen, uint32_t dstlen, void *model) 321 unsigned char *cpage_out,
322 uint32_t sourcelen, uint32_t dstlen,
323 void *model)
318{ 324{
319 int bits[8]; 325 int bits[8];
320 int c; 326 int c;
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c
index 9f9932c22adb..078a30e406b5 100644
--- a/fs/jffs2/compr_zlib.c
+++ b/fs/jffs2/compr_zlib.c
@@ -69,8 +69,10 @@ static void free_workspaces(void)
69#define free_workspaces() do { } while(0) 69#define free_workspaces() do { } while(0)
70#endif /* __KERNEL__ */ 70#endif /* __KERNEL__ */
71 71
72int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, 72static int jffs2_zlib_compress(unsigned char *data_in,
73 uint32_t *sourcelen, uint32_t *dstlen, void *model) 73 unsigned char *cpage_out,
74 uint32_t *sourcelen, uint32_t *dstlen,
75 void *model)
74{ 76{
75 int ret; 77 int ret;
76 78
@@ -135,8 +137,10 @@ int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out,
135 return ret; 137 return ret;
136} 138}
137 139
138int jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out, 140static int jffs2_zlib_decompress(unsigned char *data_in,
139 uint32_t srclen, uint32_t destlen, void *model) 141 unsigned char *cpage_out,
142 uint32_t srclen, uint32_t destlen,
143 void *model)
140{ 144{
141 int ret; 145 int ret;
142 int wbits = MAX_WBITS; 146 int wbits = MAX_WBITS;
diff --git a/fs/locks.c b/fs/locks.c
index 1792ce547af7..3fa6a7ce57a7 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -406,12 +406,12 @@ static void lease_release_private_callback(struct file_lock *fl)
406 fl->fl_file->f_owner.signum = 0; 406 fl->fl_file->f_owner.signum = 0;
407} 407}
408 408
409int lease_mylease_callback(struct file_lock *fl, struct file_lock *try) 409static int lease_mylease_callback(struct file_lock *fl, struct file_lock *try)
410{ 410{
411 return fl->fl_file == try->fl_file; 411 return fl->fl_file == try->fl_file;
412} 412}
413 413
414struct lock_manager_operations lease_manager_ops = { 414static struct lock_manager_operations lease_manager_ops = {
415 .fl_break = lease_break_callback, 415 .fl_break = lease_break_callback,
416 .fl_release_private = lease_release_private_callback, 416 .fl_release_private = lease_release_private_callback,
417 .fl_mylease = lease_mylease_callback, 417 .fl_mylease = lease_mylease_callback,
@@ -1274,7 +1274,7 @@ int fcntl_getlease(struct file *filp)
1274 * 1274 *
1275 * Called with kernel lock held. 1275 * Called with kernel lock held.
1276 */ 1276 */
1277int __setlease(struct file *filp, long arg, struct file_lock **flp) 1277static int __setlease(struct file *filp, long arg, struct file_lock **flp)
1278{ 1278{
1279 struct file_lock *fl, **before, **my_before = NULL, *lease = *flp; 1279 struct file_lock *fl, **before, **my_before = NULL, *lease = *flp;
1280 struct dentry *dentry = filp->f_dentry; 1280 struct dentry *dentry = filp->f_dentry;
diff --git a/fs/mbcache.c b/fs/mbcache.c
index f9e4d2700cd8..c7170b9221a3 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -57,7 +57,7 @@
57 57
58#define MB_CACHE_WRITER ((unsigned short)~0U >> 1) 58#define MB_CACHE_WRITER ((unsigned short)~0U >> 1)
59 59
60DECLARE_WAIT_QUEUE_HEAD(mb_cache_queue); 60static DECLARE_WAIT_QUEUE_HEAD(mb_cache_queue);
61 61
62MODULE_AUTHOR("Andreas Gruenbacher <a.gruenbacher@computer.org>"); 62MODULE_AUTHOR("Andreas Gruenbacher <a.gruenbacher@computer.org>");
63MODULE_DESCRIPTION("Meta block cache (for extended attributes)"); 63MODULE_DESCRIPTION("Meta block cache (for extended attributes)");
diff --git a/fs/mpage.c b/fs/mpage.c
index 32c7c8fcfce7..b92c0e64aefa 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -87,7 +87,7 @@ static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err)
87 return 0; 87 return 0;
88} 88}
89 89
90struct bio *mpage_bio_submit(int rw, struct bio *bio) 90static struct bio *mpage_bio_submit(int rw, struct bio *bio)
91{ 91{
92 bio->bi_end_io = mpage_end_io_read; 92 bio->bi_end_io = mpage_end_io_read;
93 if (rw == WRITE) 93 if (rw == WRITE)
@@ -627,15 +627,6 @@ int
627mpage_writepages(struct address_space *mapping, 627mpage_writepages(struct address_space *mapping,
628 struct writeback_control *wbc, get_block_t get_block) 628 struct writeback_control *wbc, get_block_t get_block)
629{ 629{
630 return __mpage_writepages(mapping, wbc, get_block,
631 mapping->a_ops->writepage);
632}
633
634int
635__mpage_writepages(struct address_space *mapping,
636 struct writeback_control *wbc, get_block_t get_block,
637 writepage_t writepage_fn)
638{
639 struct backing_dev_info *bdi = mapping->backing_dev_info; 630 struct backing_dev_info *bdi = mapping->backing_dev_info;
640 struct bio *bio = NULL; 631 struct bio *bio = NULL;
641 sector_t last_block_in_bio = 0; 632 sector_t last_block_in_bio = 0;
@@ -725,7 +716,7 @@ retry:
725 } else { 716 } else {
726 bio = __mpage_writepage(bio, page, get_block, 717 bio = __mpage_writepage(bio, page, get_block,
727 &last_block_in_bio, &ret, wbc, 718 &last_block_in_bio, &ret, wbc,
728 writepage_fn); 719 page->mapping->a_ops->writepage);
729 } 720 }
730 if (unlikely(ret == WRITEPAGE_ACTIVATE)) 721 if (unlikely(ret == WRITEPAGE_ACTIVATE))
731 unlock_page(page); 722 unlock_page(page);
@@ -755,7 +746,6 @@ retry:
755 return ret; 746 return ret;
756} 747}
757EXPORT_SYMBOL(mpage_writepages); 748EXPORT_SYMBOL(mpage_writepages);
758EXPORT_SYMBOL(__mpage_writepages);
759 749
760int mpage_writepage(struct page *page, get_block_t get_block, 750int mpage_writepage(struct page *page, get_block_t get_block,
761 struct writeback_control *wbc) 751 struct writeback_control *wbc)
diff --git a/fs/namei.c b/fs/namei.c
index 0f76fd75591b..dd78f01b6de8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1580,6 +1580,7 @@ enoent:
1580fail: 1580fail:
1581 return dentry; 1581 return dentry;
1582} 1582}
1583EXPORT_SYMBOL_GPL(lookup_create);
1583 1584
1584int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 1585int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1585{ 1586{
@@ -2071,8 +2072,8 @@ exit:
2071 * ->i_sem on parents, which works but leads to some truely excessive 2072 * ->i_sem on parents, which works but leads to some truely excessive
2072 * locking]. 2073 * locking].
2073 */ 2074 */
2074int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, 2075static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
2075 struct inode *new_dir, struct dentry *new_dentry) 2076 struct inode *new_dir, struct dentry *new_dentry)
2076{ 2077{
2077 int error = 0; 2078 int error = 0;
2078 struct inode *target; 2079 struct inode *target;
@@ -2116,8 +2117,8 @@ int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
2116 return error; 2117 return error;
2117} 2118}
2118 2119
2119int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry, 2120static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
2120 struct inode *new_dir, struct dentry *new_dentry) 2121 struct inode *new_dir, struct dentry *new_dentry)
2121{ 2122{
2122 struct inode *target; 2123 struct inode *target;
2123 int error; 2124 int error;
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index b74c4e3a64e2..87f4f9aeac86 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -79,7 +79,7 @@ static ssize_t idmap_pipe_upcall(struct file *, struct rpc_pipe_msg *,
79 char __user *, size_t); 79 char __user *, size_t);
80static ssize_t idmap_pipe_downcall(struct file *, const char __user *, 80static ssize_t idmap_pipe_downcall(struct file *, const char __user *,
81 size_t); 81 size_t);
82void idmap_pipe_destroy_msg(struct rpc_pipe_msg *); 82static void idmap_pipe_destroy_msg(struct rpc_pipe_msg *);
83 83
84static unsigned int fnvhash32(const void *, size_t); 84static unsigned int fnvhash32(const void *, size_t);
85 85
@@ -434,7 +434,7 @@ out:
434 return ret; 434 return ret;
435} 435}
436 436
437void 437static void
438idmap_pipe_destroy_msg(struct rpc_pipe_msg *msg) 438idmap_pipe_destroy_msg(struct rpc_pipe_msg *msg)
439{ 439{
440 struct idmap_msg *im = msg->data; 440 struct idmap_msg *im = msg->data;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6345f26e87ee..f2317f3e29f9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1904,7 +1904,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
1904 } 1904 }
1905} 1905}
1906 1906
1907int nfs_init_inodecache(void) 1907static int nfs_init_inodecache(void)
1908{ 1908{
1909 nfs_inode_cachep = kmem_cache_create("nfs_inode_cache", 1909 nfs_inode_cachep = kmem_cache_create("nfs_inode_cache",
1910 sizeof(struct nfs_inode), 1910 sizeof(struct nfs_inode),
@@ -1916,7 +1916,7 @@ int nfs_init_inodecache(void)
1916 return 0; 1916 return 0;
1917} 1917}
1918 1918
1919void nfs_destroy_inodecache(void) 1919static void nfs_destroy_inodecache(void)
1920{ 1920{
1921 if (kmem_cache_destroy(nfs_inode_cachep)) 1921 if (kmem_cache_destroy(nfs_inode_cachep))
1922 printk(KERN_INFO "nfs_inode_cache: not all structures were freed\n"); 1922 printk(KERN_INFO "nfs_inode_cache: not all structures were freed\n");
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 897512796edb..a912debcd20b 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -243,7 +243,7 @@ void unload_nls(struct nls_table *nls)
243 module_put(nls->owner); 243 module_put(nls->owner);
244} 244}
245 245
246wchar_t charset2uni[256] = { 246static wchar_t charset2uni[256] = {
247 /* 0x00*/ 247 /* 0x00*/
248 0x0000, 0x0001, 0x0002, 0x0003, 248 0x0000, 0x0001, 0x0002, 0x0003,
249 0x0004, 0x0005, 0x0006, 0x0007, 249 0x0004, 0x0005, 0x0006, 0x0007,
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index 17ee1b4ff087..584a27b2bbd5 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -114,9 +114,6 @@ parse_extended(struct parsed_partitions *state, struct block_device *bdev,
114 */ 114 */
115 for (i=0; i<4; i++, p++) { 115 for (i=0; i<4; i++, p++) {
116 u32 offs, size, next; 116 u32 offs, size, next;
117
118 if (SYS_IND(p) == 0)
119 continue;
120 if (!NR_SECTS(p) || is_extended_partition(p)) 117 if (!NR_SECTS(p) || is_extended_partition(p))
121 continue; 118 continue;
122 119
@@ -433,8 +430,6 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
433 for (slot = 1 ; slot <= 4 ; slot++, p++) { 430 for (slot = 1 ; slot <= 4 ; slot++, p++) {
434 u32 start = START_SECT(p)*sector_size; 431 u32 start = START_SECT(p)*sector_size;
435 u32 size = NR_SECTS(p)*sector_size; 432 u32 size = NR_SECTS(p)*sector_size;
436 if (SYS_IND(p) == 0)
437 continue;
438 if (!size) 433 if (!size)
439 continue; 434 continue;
440 if (is_extended_partition(p)) { 435 if (is_extended_partition(p)) {
diff --git a/fs/proc/mmu.c b/fs/proc/mmu.c
index a7041038ad56..25d2d9c6e329 100644
--- a/fs/proc/mmu.c
+++ b/fs/proc/mmu.c
@@ -50,13 +50,23 @@ void get_vmalloc_info(struct vmalloc_info *vmi)
50 read_lock(&vmlist_lock); 50 read_lock(&vmlist_lock);
51 51
52 for (vma = vmlist; vma; vma = vma->next) { 52 for (vma = vmlist; vma; vma = vma->next) {
53 unsigned long addr = (unsigned long) vma->addr;
54
55 /*
56 * Some archs keep another range for modules in vmlist
57 */
58 if (addr < VMALLOC_START)
59 continue;
60 if (addr >= VMALLOC_END)
61 break;
62
53 vmi->used += vma->size; 63 vmi->used += vma->size;
54 64
55 free_area_size = (unsigned long) vma->addr - prev_end; 65 free_area_size = addr - prev_end;
56 if (vmi->largest_chunk < free_area_size) 66 if (vmi->largest_chunk < free_area_size)
57 vmi->largest_chunk = free_area_size; 67 vmi->largest_chunk = free_area_size;
58 68
59 prev_end = vma->size + (unsigned long) vma->addr; 69 prev_end = vma->size + addr;
60 } 70 }
61 71
62 if (VMALLOC_END - prev_end > vmi->largest_chunk) 72 if (VMALLOC_END - prev_end > vmi->largest_chunk)
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index 67423c696c0a..6fd57f154197 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -12,15 +12,8 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13 13
14#ifndef HAVE_ARCH_DEVTREE_FIXUPS 14#ifndef HAVE_ARCH_DEVTREE_FIXUPS
15static inline void set_node_proc_entry(struct device_node *np, struct proc_dir_entry *de) 15static inline void set_node_proc_entry(struct device_node *np,
16{ 16 struct proc_dir_entry *de)
17}
18
19static void inline set_node_name_link(struct device_node *np, struct proc_dir_entry *de)
20{
21}
22
23static void inline set_node_addr_link(struct device_node *np, struct proc_dir_entry *de)
24{ 17{
25} 18}
26#endif 19#endif
@@ -58,89 +51,67 @@ static int property_read_proc(char *page, char **start, off_t off,
58/* 51/*
59 * Process a node, adding entries for its children and its properties. 52 * Process a node, adding entries for its children and its properties.
60 */ 53 */
61void proc_device_tree_add_node(struct device_node *np, struct proc_dir_entry *de) 54void proc_device_tree_add_node(struct device_node *np,
55 struct proc_dir_entry *de)
62{ 56{
63 struct property *pp; 57 struct property *pp;
64 struct proc_dir_entry *ent; 58 struct proc_dir_entry *ent;
65 struct device_node *child, *sib; 59 struct device_node *child;
66 const char *p, *at; 60 struct proc_dir_entry *list = NULL, **lastp;
67 int l; 61 const char *p;
68 struct proc_dir_entry *list, **lastp, *al;
69 62
70 set_node_proc_entry(np, de); 63 set_node_proc_entry(np, de);
71 lastp = &list; 64 lastp = &list;
72 for (pp = np->properties; pp != 0; pp = pp->next) { 65 for (child = NULL; (child = of_get_next_child(np, child));) {
73 /*
74 * Unfortunately proc_register puts each new entry
75 * at the beginning of the list. So we rearrange them.
76 */
77 ent = create_proc_read_entry(pp->name, strncmp(pp->name, "security-", 9) ?
78 S_IRUGO : S_IRUSR, de, property_read_proc, pp);
79 if (ent == 0)
80 break;
81 if (!strncmp(pp->name, "security-", 9))
82 ent->size = 0; /* don't leak number of password chars */
83 else
84 ent->size = pp->length;
85 *lastp = ent;
86 lastp = &ent->next;
87 }
88 child = NULL;
89 while ((child = of_get_next_child(np, child))) {
90 p = strrchr(child->full_name, '/'); 66 p = strrchr(child->full_name, '/');
91 if (!p) 67 if (!p)
92 p = child->full_name; 68 p = child->full_name;
93 else 69 else
94 ++p; 70 ++p;
95 /* chop off '@0' if the name ends with that */
96 l = strlen(p);
97 if (l > 2 && p[l-2] == '@' && p[l-1] == '0')
98 l -= 2;
99 ent = proc_mkdir(p, de); 71 ent = proc_mkdir(p, de);
100 if (ent == 0) 72 if (ent == 0)
101 break; 73 break;
102 *lastp = ent; 74 *lastp = ent;
75 ent->next = NULL;
103 lastp = &ent->next; 76 lastp = &ent->next;
104 proc_device_tree_add_node(child, ent); 77 proc_device_tree_add_node(child, ent);
105 78 }
106 /* 79 of_node_put(child);
107 * If we left the address part on the name, consider 80 for (pp = np->properties; pp != 0; pp = pp->next) {
108 * adding symlinks from the name and address parts.
109 */
110 if (p[l] != 0 || (at = strchr(p, '@')) == 0)
111 continue;
112
113 /* 81 /*
114 * If this is the first node with a given name property, 82 * Yet another Apple device-tree bogosity: on some machines,
115 * add a symlink with the name property as its name. 83 * they have properties & nodes with the same name. Those
84 * properties are quite unimportant for us though, thus we
85 * simply "skip" them here, but we do have to check.
116 */ 86 */
117 sib = NULL; 87 for (ent = list; ent != NULL; ent = ent->next)
118 while ((sib = of_get_next_child(np, sib)) && sib != child) 88 if (!strcmp(ent->name, pp->name))
119 if (sib->name && strcmp(sib->name, child->name) == 0)
120 break;
121 if (sib == child && strncmp(p, child->name, l) != 0) {
122 al = proc_symlink(child->name, de, ent->name);
123 if (al == 0) {
124 of_node_put(sib);
125 break; 89 break;
126 } 90 if (ent != NULL) {
127 set_node_name_link(child, al); 91 printk(KERN_WARNING "device-tree: property \"%s\" name"
128 *lastp = al; 92 " conflicts with node in %s\n", pp->name,
129 lastp = &al->next; 93 np->full_name);
94 continue;
130 } 95 }
131 of_node_put(sib); 96
132 /* 97 /*
133 * Add another directory with the @address part as its name. 98 * Unfortunately proc_register puts each new entry
99 * at the beginning of the list. So we rearrange them.
134 */ 100 */
135 al = proc_symlink(at, de, ent->name); 101 ent = create_proc_read_entry(pp->name,
136 if (al == 0) 102 strncmp(pp->name, "security-", 9)
103 ? S_IRUGO : S_IRUSR, de,
104 property_read_proc, pp);
105 if (ent == 0)
137 break; 106 break;
138 set_node_addr_link(child, al); 107 if (!strncmp(pp->name, "security-", 9))
139 *lastp = al; 108 ent->size = 0; /* don't leak number of password chars */
140 lastp = &al->next; 109 else
110 ent->size = pp->length;
111 ent->next = NULL;
112 *lastp = ent;
113 lastp = &ent->next;
141 } 114 }
142 of_node_put(child);
143 *lastp = NULL;
144 de->subdir = list; 115 de->subdir = list;
145} 116}
146 117
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 80e92d9b81cb..7d4dc5f5aa8b 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -608,7 +608,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode,
608 goto out_failed; 608 goto out_failed;
609 } 609 }
610 610
611 retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode); 611 retval = reiserfs_new_inode (&th, dir, mode, NULL, 0/*i_size*/, dentry, inode);
612 if (retval) 612 if (retval)
613 goto out_failed; 613 goto out_failed;
614 614
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index da23ba75f3d5..c47f8fd31a2d 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -230,7 +230,6 @@ const struct reiserfs_key MAX_KEY = {
230 __constant_cpu_to_le32(0xffffffff)},} 230 __constant_cpu_to_le32(0xffffffff)},}
231}; 231};
232 232
233const struct in_core_key MAX_IN_CORE_KEY = {~0U, ~0U, ~0ULL>>4, 15};
234 233
235/* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom 234/* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom
236 of the path, and going upwards. We must check the path's validity at each step. If the key is not in 235 of the path, and going upwards. We must check the path's validity at each step. If the key is not in
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 31e75125f48b..b35b87744983 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -164,7 +164,9 @@ static int finish_unfinished (struct super_block * s)
164 164
165 /* compose key to look for "save" links */ 165 /* compose key to look for "save" links */
166 max_cpu_key.version = KEY_FORMAT_3_5; 166 max_cpu_key.version = KEY_FORMAT_3_5;
167 max_cpu_key.on_disk_key = MAX_IN_CORE_KEY; 167 max_cpu_key.on_disk_key.k_dir_id = ~0U;
168 max_cpu_key.on_disk_key.k_objectid = ~0U;
169 set_cpu_key_k_offset (&max_cpu_key, ~0U);
168 max_cpu_key.key_length = 3; 170 max_cpu_key.key_length = 3;
169 171
170#ifdef CONFIG_QUOTA 172#ifdef CONFIG_QUOTA
diff --git a/fs/select.c b/fs/select.c
index 25b1ccac2f2c..b80e7eb0ac0d 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -55,7 +55,8 @@ struct poll_table_page {
55 * as all select/poll functions have to call it to add an entry to the 55 * as all select/poll functions have to call it to add an entry to the
56 * poll table. 56 * poll table.
57 */ 57 */
58void __pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p); 58static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
59 poll_table *p);
59 60
60void poll_initwait(struct poll_wqueues *pwq) 61void poll_initwait(struct poll_wqueues *pwq)
61{ 62{
@@ -87,7 +88,8 @@ void poll_freewait(struct poll_wqueues *pwq)
87 88
88EXPORT_SYMBOL(poll_freewait); 89EXPORT_SYMBOL(poll_freewait);
89 90
90void __pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *_p) 91static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
92 poll_table *_p)
91{ 93{
92 struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt); 94 struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt);
93 struct poll_table_page *table = p->table; 95 struct poll_table_page *table = p->table;
diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c
index c2634bda6b50..85d8dbe843f1 100644
--- a/fs/udf/udftime.c
+++ b/fs/udf/udftime.c
@@ -46,7 +46,7 @@
46#endif 46#endif
47 47
48/* How many days come before each month (0-12). */ 48/* How many days come before each month (0-12). */
49const unsigned short int __mon_yday[2][13] = 49static const unsigned short int __mon_yday[2][13] =
50{ 50{
51 /* Normal years. */ 51 /* Normal years. */
52 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, 52 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
@@ -103,7 +103,7 @@ udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src)
103 offset = 0; 103 offset = 0;
104 104
105 if ((src.year < EPOCH_YEAR) || 105 if ((src.year < EPOCH_YEAR) ||
106 (src.year > EPOCH_YEAR+MAX_YEAR_SECONDS)) 106 (src.year >= EPOCH_YEAR+MAX_YEAR_SECONDS))
107 { 107 {
108 *dest = -1; 108 *dest = -1;
109 *dest_usec = -1; 109 *dest_usec = -1;
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 554e4a18c152..d3ff78354638 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -49,7 +49,7 @@ ifeq ($(CONFIG_XFS_TRACE),y)
49 EXTRA_CFLAGS += -DXFS_LOG_TRACE 49 EXTRA_CFLAGS += -DXFS_LOG_TRACE
50 EXTRA_CFLAGS += -DXFS_RW_TRACE 50 EXTRA_CFLAGS += -DXFS_RW_TRACE
51 EXTRA_CFLAGS += -DPAGEBUF_TRACE 51 EXTRA_CFLAGS += -DPAGEBUF_TRACE
52 # EXTRA_CFLAGS += -DXFS_VNODE_TRACE 52 EXTRA_CFLAGS += -DXFS_VNODE_TRACE
53endif 53endif
54 54
55obj-$(CONFIG_XFS_FS) += xfs.o 55obj-$(CONFIG_XFS_FS) += xfs.o
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 76a84758073a..93ce257cd149 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -558,7 +558,8 @@ xfs_submit_page(
558 int i; 558 int i;
559 559
560 BUG_ON(PageWriteback(page)); 560 BUG_ON(PageWriteback(page));
561 set_page_writeback(page); 561 if (bh_count)
562 set_page_writeback(page);
562 if (clear_dirty) 563 if (clear_dirty)
563 clear_page_dirty(page); 564 clear_page_dirty(page);
564 unlock_page(page); 565 unlock_page(page);
@@ -578,9 +579,6 @@ xfs_submit_page(
578 579
579 if (probed_page && clear_dirty) 580 if (probed_page && clear_dirty)
580 wbc->nr_to_write--; /* Wrote an "extra" page */ 581 wbc->nr_to_write--; /* Wrote an "extra" page */
581 } else {
582 end_page_writeback(page);
583 wbc->pages_skipped++; /* We didn't write this page */
584 } 582 }
585} 583}
586 584
@@ -602,21 +600,26 @@ xfs_convert_page(
602{ 600{
603 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head; 601 struct buffer_head *bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
604 xfs_iomap_t *mp = iomapp, *tmp; 602 xfs_iomap_t *mp = iomapp, *tmp;
605 unsigned long end, offset; 603 unsigned long offset, end_offset;
606 pgoff_t end_index; 604 int index = 0;
607 int i = 0, index = 0;
608 int bbits = inode->i_blkbits; 605 int bbits = inode->i_blkbits;
606 int len, page_dirty;
609 607
610 end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT; 608 end_offset = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1));
611 if (page->index < end_index) { 609
612 end = PAGE_CACHE_SIZE; 610 /*
613 } else { 611 * page_dirty is initially a count of buffers on the page before
614 end = i_size_read(inode) & (PAGE_CACHE_SIZE-1); 612 * EOF and is decrememted as we move each into a cleanable state.
615 } 613 */
614 len = 1 << inode->i_blkbits;
615 end_offset = max(end_offset, PAGE_CACHE_SIZE);
616 end_offset = roundup(end_offset, len);
617 page_dirty = end_offset / len;
618
619 offset = 0;
616 bh = head = page_buffers(page); 620 bh = head = page_buffers(page);
617 do { 621 do {
618 offset = i << bbits; 622 if (offset >= end_offset)
619 if (offset >= end)
620 break; 623 break;
621 if (!(PageUptodate(page) || buffer_uptodate(bh))) 624 if (!(PageUptodate(page) || buffer_uptodate(bh)))
622 continue; 625 continue;
@@ -625,6 +628,7 @@ xfs_convert_page(
625 if (startio) { 628 if (startio) {
626 lock_buffer(bh); 629 lock_buffer(bh);
627 bh_arr[index++] = bh; 630 bh_arr[index++] = bh;
631 page_dirty--;
628 } 632 }
629 continue; 633 continue;
630 } 634 }
@@ -657,10 +661,11 @@ xfs_convert_page(
657 unlock_buffer(bh); 661 unlock_buffer(bh);
658 mark_buffer_dirty(bh); 662 mark_buffer_dirty(bh);
659 } 663 }
660 } while (i++, (bh = bh->b_this_page) != head); 664 page_dirty--;
665 } while (offset += len, (bh = bh->b_this_page) != head);
661 666
662 if (startio) { 667 if (startio && index) {
663 xfs_submit_page(page, wbc, bh_arr, index, 1, index == i); 668 xfs_submit_page(page, wbc, bh_arr, index, 1, !page_dirty);
664 } else { 669 } else {
665 unlock_page(page); 670 unlock_page(page);
666 } 671 }
@@ -725,8 +730,11 @@ xfs_page_state_convert(
725 __uint64_t end_offset; 730 __uint64_t end_offset;
726 pgoff_t end_index, last_index, tlast; 731 pgoff_t end_index, last_index, tlast;
727 int len, err, i, cnt = 0, uptodate = 1; 732 int len, err, i, cnt = 0, uptodate = 1;
728 int flags = startio ? 0 : BMAPI_TRYLOCK; 733 int flags;
729 int page_dirty, delalloc = 0; 734 int page_dirty;
735
736 /* wait for other IO threads? */
737 flags = (startio && wbc->sync_mode != WB_SYNC_NONE) ? 0 : BMAPI_TRYLOCK;
730 738
731 /* Is this page beyond the end of the file? */ 739 /* Is this page beyond the end of the file? */
732 offset = i_size_read(inode); 740 offset = i_size_read(inode);
@@ -740,19 +748,22 @@ xfs_page_state_convert(
740 } 748 }
741 } 749 }
742 750
743 offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
744 end_offset = min_t(unsigned long long, 751 end_offset = min_t(unsigned long long,
745 offset + PAGE_CACHE_SIZE, i_size_read(inode)); 752 (loff_t)(page->index + 1) << PAGE_CACHE_SHIFT, offset);
746 753 offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
747 bh = head = page_buffers(page);
748 iomp = NULL;
749 754
750 /* 755 /*
751 * page_dirty is initially a count of buffers on the page and 756 * page_dirty is initially a count of buffers on the page before
752 * is decrememted as we move each into a cleanable state. 757 * EOF and is decrememted as we move each into a cleanable state.
753 */ 758 */
754 len = bh->b_size; 759 len = 1 << inode->i_blkbits;
755 page_dirty = PAGE_CACHE_SIZE / len; 760 p_offset = max(p_offset, PAGE_CACHE_SIZE);
761 p_offset = roundup(p_offset, len);
762 page_dirty = p_offset / len;
763
764 iomp = NULL;
765 p_offset = 0;
766 bh = head = page_buffers(page);
756 767
757 do { 768 do {
758 if (offset >= end_offset) 769 if (offset >= end_offset)
@@ -804,7 +815,6 @@ xfs_page_state_convert(
804 */ 815 */
805 } else if (buffer_delay(bh)) { 816 } else if (buffer_delay(bh)) {
806 if (!iomp) { 817 if (!iomp) {
807 delalloc = 1;
808 err = xfs_map_blocks(inode, offset, len, &iomap, 818 err = xfs_map_blocks(inode, offset, len, &iomap,
809 BMAPI_ALLOCATE | flags); 819 BMAPI_ALLOCATE | flags);
810 if (err) { 820 if (err) {
@@ -875,14 +885,14 @@ xfs_page_state_convert(
875 if (uptodate && bh == head) 885 if (uptodate && bh == head)
876 SetPageUptodate(page); 886 SetPageUptodate(page);
877 887
878 if (startio) 888 if (startio) {
879 xfs_submit_page(page, wbc, bh_arr, cnt, 0, 1); 889 xfs_submit_page(page, wbc, bh_arr, cnt, 0, !page_dirty);
890 }
880 891
881 if (iomp) { 892 if (iomp) {
882 tlast = (iomp->iomap_offset + iomp->iomap_bsize - 1) >> 893 offset = (iomp->iomap_offset + iomp->iomap_bsize - 1) >>
883 PAGE_CACHE_SHIFT; 894 PAGE_CACHE_SHIFT;
884 if (delalloc && (tlast > last_index)) 895 tlast = min_t(pgoff_t, offset, last_index);
885 tlast = last_index;
886 xfs_cluster_write(inode, page->index + 1, iomp, wbc, 896 xfs_cluster_write(inode, page->index + 1, iomp, wbc,
887 startio, unmapped, tlast); 897 startio, unmapped, tlast);
888 } 898 }
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 23e0eb67fc25..997963e53622 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1746,13 +1746,15 @@ STATIC DECLARE_COMPLETION(pagebuf_daemon_done);
1746STATIC struct task_struct *pagebuf_daemon_task; 1746STATIC struct task_struct *pagebuf_daemon_task;
1747STATIC int pagebuf_daemon_active; 1747STATIC int pagebuf_daemon_active;
1748STATIC int force_flush; 1748STATIC int force_flush;
1749 1749STATIC int force_sleep;
1750 1750
1751STATIC int 1751STATIC int
1752pagebuf_daemon_wakeup( 1752pagebuf_daemon_wakeup(
1753 int priority, 1753 int priority,
1754 unsigned int mask) 1754 unsigned int mask)
1755{ 1755{
1756 if (force_sleep)
1757 return 0;
1756 force_flush = 1; 1758 force_flush = 1;
1757 barrier(); 1759 barrier();
1758 wake_up_process(pagebuf_daemon_task); 1760 wake_up_process(pagebuf_daemon_task);
@@ -1778,7 +1780,12 @@ pagebuf_daemon(
1778 1780
1779 INIT_LIST_HEAD(&tmp); 1781 INIT_LIST_HEAD(&tmp);
1780 do { 1782 do {
1781 try_to_freeze(PF_FREEZE); 1783 if (unlikely(current->flags & PF_FREEZE)) {
1784 force_sleep = 1;
1785 refrigerator(PF_FREEZE);
1786 } else {
1787 force_sleep = 0;
1788 }
1782 1789
1783 set_current_state(TASK_INTERRUPTIBLE); 1790 set_current_state(TASK_INTERRUPTIBLE);
1784 schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100); 1791 schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100);
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 9f057a4a5b06..24fa3b101b93 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -515,10 +515,49 @@ open_exec_out:
515} 515}
516#endif /* HAVE_FOP_OPEN_EXEC */ 516#endif /* HAVE_FOP_OPEN_EXEC */
517 517
518/*
519 * Temporary workaround to the AIO direct IO write problem.
520 * This code can go and we can revert to do_sync_write once
521 * the writepage(s) rework is merged.
522 */
523STATIC ssize_t
524linvfs_write(
525 struct file *filp,
526 const char __user *buf,
527 size_t len,
528 loff_t *ppos)
529{
530 struct kiocb kiocb;
531 ssize_t ret;
532
533 init_sync_kiocb(&kiocb, filp);
534 kiocb.ki_pos = *ppos;
535 ret = __linvfs_write(&kiocb, buf, 0, len, kiocb.ki_pos);
536 *ppos = kiocb.ki_pos;
537 return ret;
538}
539STATIC ssize_t
540linvfs_write_invis(
541 struct file *filp,
542 const char __user *buf,
543 size_t len,
544 loff_t *ppos)
545{
546 struct kiocb kiocb;
547 ssize_t ret;
548
549 init_sync_kiocb(&kiocb, filp);
550 kiocb.ki_pos = *ppos;
551 ret = __linvfs_write(&kiocb, buf, IO_INVIS, len, kiocb.ki_pos);
552 *ppos = kiocb.ki_pos;
553 return ret;
554}
555
556
518struct file_operations linvfs_file_operations = { 557struct file_operations linvfs_file_operations = {
519 .llseek = generic_file_llseek, 558 .llseek = generic_file_llseek,
520 .read = do_sync_read, 559 .read = do_sync_read,
521 .write = do_sync_write, 560 .write = linvfs_write,
522 .readv = linvfs_readv, 561 .readv = linvfs_readv,
523 .writev = linvfs_writev, 562 .writev = linvfs_writev,
524 .aio_read = linvfs_aio_read, 563 .aio_read = linvfs_aio_read,
@@ -526,7 +565,7 @@ struct file_operations linvfs_file_operations = {
526 .sendfile = linvfs_sendfile, 565 .sendfile = linvfs_sendfile,
527 .unlocked_ioctl = linvfs_ioctl, 566 .unlocked_ioctl = linvfs_ioctl,
528#ifdef CONFIG_COMPAT 567#ifdef CONFIG_COMPAT
529 .compat_ioctl = xfs_compat_ioctl, 568 .compat_ioctl = linvfs_compat_ioctl,
530#endif 569#endif
531 .mmap = linvfs_file_mmap, 570 .mmap = linvfs_file_mmap,
532 .open = linvfs_open, 571 .open = linvfs_open,
@@ -540,7 +579,7 @@ struct file_operations linvfs_file_operations = {
540struct file_operations linvfs_invis_file_operations = { 579struct file_operations linvfs_invis_file_operations = {
541 .llseek = generic_file_llseek, 580 .llseek = generic_file_llseek,
542 .read = do_sync_read, 581 .read = do_sync_read,
543 .write = do_sync_write, 582 .write = linvfs_write_invis,
544 .readv = linvfs_readv_invis, 583 .readv = linvfs_readv_invis,
545 .writev = linvfs_writev_invis, 584 .writev = linvfs_writev_invis,
546 .aio_read = linvfs_aio_read_invis, 585 .aio_read = linvfs_aio_read_invis,
@@ -548,7 +587,7 @@ struct file_operations linvfs_invis_file_operations = {
548 .sendfile = linvfs_sendfile, 587 .sendfile = linvfs_sendfile,
549 .unlocked_ioctl = linvfs_ioctl_invis, 588 .unlocked_ioctl = linvfs_ioctl_invis,
550#ifdef CONFIG_COMPAT 589#ifdef CONFIG_COMPAT
551 .compat_ioctl = xfs_compat_invis_ioctl, 590 .compat_ioctl = linvfs_compat_invis_ioctl,
552#endif 591#endif
553 .mmap = linvfs_file_mmap, 592 .mmap = linvfs_file_mmap,
554 .open = linvfs_open, 593 .open = linvfs_open,
@@ -561,6 +600,9 @@ struct file_operations linvfs_dir_operations = {
561 .read = generic_read_dir, 600 .read = generic_read_dir,
562 .readdir = linvfs_readdir, 601 .readdir = linvfs_readdir,
563 .unlocked_ioctl = linvfs_ioctl, 602 .unlocked_ioctl = linvfs_ioctl,
603#ifdef CONFIG_COMPAT
604 .compat_ioctl = linvfs_compat_ioctl,
605#endif
564 .fsync = linvfs_fsync, 606 .fsync = linvfs_fsync,
565}; 607};
566 608
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 7a12c83184f5..0f8f1384eb36 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -58,8 +58,9 @@ typedef struct xfs_fsop_bulkreq32 {
58 __s32 ocount; /* output count pointer */ 58 __s32 ocount; /* output count pointer */
59} xfs_fsop_bulkreq32_t; 59} xfs_fsop_bulkreq32_t;
60 60
61static unsigned long 61STATIC unsigned long
62xfs_ioctl32_bulkstat(unsigned long arg) 62xfs_ioctl32_bulkstat(
63 unsigned long arg)
63{ 64{
64 xfs_fsop_bulkreq32_t __user *p32 = (void __user *)arg; 65 xfs_fsop_bulkreq32_t __user *p32 = (void __user *)arg;
65 xfs_fsop_bulkreq_t __user *p = compat_alloc_user_space(sizeof(*p)); 66 xfs_fsop_bulkreq_t __user *p = compat_alloc_user_space(sizeof(*p));
@@ -78,11 +79,11 @@ xfs_ioctl32_bulkstat(unsigned long arg)
78} 79}
79#endif 80#endif
80 81
81static long 82STATIC long
82__xfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg) 83__linvfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg)
83{ 84{
84 int error; 85 int error;
85 struct inode *inode = f->f_dentry->d_inode; 86 struct inode *inode = f->f_dentry->d_inode;
86 vnode_t *vp = LINVFS_GET_VP(inode); 87 vnode_t *vp = LINVFS_GET_VP(inode);
87 88
88 switch (cmd) { 89 switch (cmd) {
@@ -152,12 +153,20 @@ __xfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg)
152 return error; 153 return error;
153} 154}
154 155
155long xfs_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg) 156long
157linvfs_compat_ioctl(
158 struct file *f,
159 unsigned cmd,
160 unsigned long arg)
156{ 161{
157 return __xfs_compat_ioctl(0, f, cmd, arg); 162 return __linvfs_compat_ioctl(0, f, cmd, arg);
158} 163}
159 164
160long xfs_compat_invis_ioctl(struct file *f, unsigned cmd, unsigned long arg) 165long
166linvfs_compat_invis_ioctl(
167 struct file *f,
168 unsigned cmd,
169 unsigned long arg)
161{ 170{
162 return __xfs_compat_ioctl(IO_INVIS, f, cmd, arg); 171 return __linvfs_compat_ioctl(IO_INVIS, f, cmd, arg);
163} 172}
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.h b/fs/xfs/linux-2.6/xfs_ioctl32.h
index 779f69a48116..c874793a1dc9 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.h
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -30,5 +30,5 @@
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32 32
33long xfs_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg); 33long linvfs_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
34long xfs_compat_invis_ioctl(struct file *f, unsigned cmd, unsigned long arg); 34long linvfs_compat_invis_ioctl(struct file *f, unsigned cmd, unsigned long arg);
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index ff145fd0d1a4..aa9daaea6c34 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -683,6 +683,9 @@ xfs_write(
683 (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ? 683 (xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
684 mp->m_rtdev_targp : mp->m_ddev_targp; 684 mp->m_rtdev_targp : mp->m_ddev_targp;
685 685
686 if (ioflags & IO_ISAIO)
687 return XFS_ERROR(-ENOSYS);
688
686 if ((pos & target->pbr_smask) || (count & target->pbr_smask)) 689 if ((pos & target->pbr_smask) || (count & target->pbr_smask))
687 return XFS_ERROR(-EINVAL); 690 return XFS_ERROR(-EINVAL);
688 691
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 53dc658cafa6..455e2b2fb964 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -66,7 +66,6 @@
66#include "xfs_buf_item.h" 66#include "xfs_buf_item.h"
67#include "xfs_utils.h" 67#include "xfs_utils.h"
68#include "xfs_version.h" 68#include "xfs_version.h"
69#include "xfs_ioctl32.h"
70 69
71#include <linux/namei.h> 70#include <linux/namei.h>
72#include <linux/init.h> 71#include <linux/init.h>
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 849c61c74f3c..a832d165f24f 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -156,7 +156,6 @@ vn_initialize(
156 156
157#ifdef XFS_VNODE_TRACE 157#ifdef XFS_VNODE_TRACE
158 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP); 158 vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
159 printk("Allocated VNODE_TRACE at 0x%p\n", vp->v_trace);
160#endif /* XFS_VNODE_TRACE */ 159#endif /* XFS_VNODE_TRACE */
161 160
162 vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address); 161 vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address);
@@ -424,13 +423,13 @@ vn_remove(
424 * Vnode tracing code. 423 * Vnode tracing code.
425 */ 424 */
426void 425void
427vn_trace_entry(vnode_t *vp, char *func, inst_t *ra) 426vn_trace_entry(vnode_t *vp, const char *func, inst_t *ra)
428{ 427{
429 KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra); 428 KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra);
430} 429}
431 430
432void 431void
433vn_trace_exit(vnode_t *vp, char *func, inst_t *ra) 432vn_trace_exit(vnode_t *vp, const char *func, inst_t *ra)
434{ 433{
435 KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra); 434 KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra);
436} 435}
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index da76c1f1e11c..00466c3194ac 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -86,10 +86,11 @@ typedef struct vnode {
86 vnumber_t v_number; /* in-core vnode number */ 86 vnumber_t v_number; /* in-core vnode number */
87 vn_bhv_head_t v_bh; /* behavior head */ 87 vn_bhv_head_t v_bh; /* behavior head */
88 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */ 88 spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */
89 struct inode v_inode; /* Linux inode */
90#ifdef XFS_VNODE_TRACE 89#ifdef XFS_VNODE_TRACE
91 struct ktrace *v_trace; /* trace header structure */ 90 struct ktrace *v_trace; /* trace header structure */
92#endif 91#endif
92 struct inode v_inode; /* Linux inode */
93 /* inode MUST be last */
93} vnode_t; 94} vnode_t;
94 95
95#define v_fbhv v_bh.bh_first /* first behavior */ 96#define v_fbhv v_bh.bh_first /* first behavior */
@@ -409,7 +410,7 @@ typedef struct vattr {
409 int va_mask; /* bit-mask of attributes present */ 410 int va_mask; /* bit-mask of attributes present */
410 enum vtype va_type; /* vnode type (for create) */ 411 enum vtype va_type; /* vnode type (for create) */
411 mode_t va_mode; /* file access mode and type */ 412 mode_t va_mode; /* file access mode and type */
412 nlink_t va_nlink; /* number of references to file */ 413 xfs_nlink_t va_nlink; /* number of references to file */
413 uid_t va_uid; /* owner user id */ 414 uid_t va_uid; /* owner user id */
414 gid_t va_gid; /* owner group id */ 415 gid_t va_gid; /* owner group id */
415 xfs_ino_t va_nodeid; /* file id */ 416 xfs_ino_t va_nodeid; /* file id */
@@ -625,6 +626,7 @@ static inline int VN_BAD(struct vnode *vp)
625#define ATTR_DMI 0x08 /* invocation from a DMI function */ 626#define ATTR_DMI 0x08 /* invocation from a DMI function */
626#define ATTR_LAZY 0x80 /* set/get attributes lazily */ 627#define ATTR_LAZY 0x80 /* set/get attributes lazily */
627#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ 628#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */
629#define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */
628 630
629/* 631/*
630 * Flags to VOP_FSYNC and VOP_RECLAIM. 632 * Flags to VOP_FSYNC and VOP_RECLAIM.
@@ -646,8 +648,8 @@ static inline int VN_BAD(struct vnode *vp)
646#define VNODE_KTRACE_REF 4 648#define VNODE_KTRACE_REF 4
647#define VNODE_KTRACE_RELE 5 649#define VNODE_KTRACE_RELE 5
648 650
649extern void vn_trace_entry(struct vnode *, char *, inst_t *); 651extern void vn_trace_entry(struct vnode *, const char *, inst_t *);
650extern void vn_trace_exit(struct vnode *, char *, inst_t *); 652extern void vn_trace_exit(struct vnode *, const char *, inst_t *);
651extern void vn_trace_hold(struct vnode *, char *, int, inst_t *); 653extern void vn_trace_hold(struct vnode *, char *, int, inst_t *);
652extern void vn_trace_ref(struct vnode *, char *, int, inst_t *); 654extern void vn_trace_ref(struct vnode *, char *, int, inst_t *);
653extern void vn_trace_rele(struct vnode *, char *, int, inst_t *); 655extern void vn_trace_rele(struct vnode *, char *, int, inst_t *);
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 08d551a17347..63abdc2ac7f4 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -182,7 +182,7 @@ xfs_swapext(
182 182
183 if (VN_CACHED(tvp) != 0) 183 if (VN_CACHED(tvp) != 0)
184 xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore), 184 xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore),
185 (loff_t)0, 0, 0); 185 (xfs_off_t)0, 0, 0);
186 186
187 /* Verify O_DIRECT for ftmp */ 187 /* Verify O_DIRECT for ftmp */
188 if (VN_CACHED(tvp) != 0) { 188 if (VN_CACHED(tvp) != 0) {
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 3a0ba1dfd0e8..d3da00045f26 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -136,6 +136,40 @@ xfs_chash_free(xfs_mount_t *mp)
136} 136}
137 137
138/* 138/*
139 * Try to move an inode to the front of its hash list if possible
140 * (and if its not there already). Called right after obtaining
141 * the list version number and then dropping the read_lock on the
142 * hash list in question (which is done right after looking up the
143 * inode in question...).
144 */
145STATIC void
146xfs_ihash_promote(
147 xfs_ihash_t *ih,
148 xfs_inode_t *ip,
149 ulong version)
150{
151 xfs_inode_t *iq;
152
153 if ((ip->i_prevp != &ih->ih_next) && write_trylock(&ih->ih_lock)) {
154 if (likely(version == ih->ih_version)) {
155 /* remove from list */
156 if ((iq = ip->i_next)) {
157 iq->i_prevp = ip->i_prevp;
158 }
159 *ip->i_prevp = iq;
160
161 /* insert at list head */
162 iq = ih->ih_next;
163 iq->i_prevp = &ip->i_next;
164 ip->i_next = iq;
165 ip->i_prevp = &ih->ih_next;
166 ih->ih_next = ip;
167 }
168 write_unlock(&ih->ih_lock);
169 }
170}
171
172/*
139 * Look up an inode by number in the given file system. 173 * Look up an inode by number in the given file system.
140 * The inode is looked up in the hash table for the file system 174 * The inode is looked up in the hash table for the file system
141 * represented by the mount point parameter mp. Each bucket of 175 * represented by the mount point parameter mp. Each bucket of
@@ -229,7 +263,9 @@ again:
229 XFS_STATS_INC(xs_ig_found); 263 XFS_STATS_INC(xs_ig_found);
230 264
231 ip->i_flags &= ~XFS_IRECLAIMABLE; 265 ip->i_flags &= ~XFS_IRECLAIMABLE;
266 version = ih->ih_version;
232 read_unlock(&ih->ih_lock); 267 read_unlock(&ih->ih_lock);
268 xfs_ihash_promote(ih, ip, version);
233 269
234 XFS_MOUNT_ILOCK(mp); 270 XFS_MOUNT_ILOCK(mp);
235 list_del_init(&ip->i_reclaim); 271 list_del_init(&ip->i_reclaim);
@@ -259,8 +295,15 @@ again:
259 inode_vp, vp); 295 inode_vp, vp);
260 } 296 }
261 297
298 /*
299 * Inode cache hit: if ip is not at the front of
300 * its hash chain, move it there now.
301 * Do this with the lock held for update, but
302 * do statistics after releasing the lock.
303 */
304 version = ih->ih_version;
262 read_unlock(&ih->ih_lock); 305 read_unlock(&ih->ih_lock);
263 306 xfs_ihash_promote(ih, ip, version);
264 XFS_STATS_INC(xs_ig_found); 307 XFS_STATS_INC(xs_ig_found);
265 308
266finish_inode: 309finish_inode:
@@ -547,6 +590,7 @@ xfs_inode_incore(xfs_mount_t *mp,
547{ 590{
548 xfs_ihash_t *ih; 591 xfs_ihash_t *ih;
549 xfs_inode_t *ip; 592 xfs_inode_t *ip;
593 ulong version;
550 594
551 ih = XFS_IHASH(mp, ino); 595 ih = XFS_IHASH(mp, ino);
552 read_lock(&ih->ih_lock); 596 read_lock(&ih->ih_lock);
@@ -554,11 +598,15 @@ xfs_inode_incore(xfs_mount_t *mp,
554 if (ip->i_ino == ino) { 598 if (ip->i_ino == ino) {
555 /* 599 /*
556 * If we find it and tp matches, return it. 600 * If we find it and tp matches, return it.
601 * Also move it to the front of the hash list
602 * if we find it and it is not already there.
557 * Otherwise break from the loop and return 603 * Otherwise break from the loop and return
558 * NULL. 604 * NULL.
559 */ 605 */
560 if (ip->i_transp == tp) { 606 if (ip->i_transp == tp) {
607 version = ih->ih_version;
561 read_unlock(&ih->ih_lock); 608 read_unlock(&ih->ih_lock);
609 xfs_ihash_promote(ih, ip, version);
562 return (ip); 610 return (ip);
563 } 611 }
564 break; 612 break;
@@ -685,6 +733,7 @@ xfs_iextract(
685 iq->i_prevp = ip->i_prevp; 733 iq->i_prevp = ip->i_prevp;
686 } 734 }
687 *ip->i_prevp = iq; 735 *ip->i_prevp = iq;
736 ih->ih_version++;
688 write_unlock(&ih->ih_lock); 737 write_unlock(&ih->ih_lock);
689 738
690 /* 739 /*
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 43c632ab86ad..bc8c8c7f9039 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1130,7 +1130,7 @@ xfs_ialloc(
1130 xfs_trans_t *tp, 1130 xfs_trans_t *tp,
1131 xfs_inode_t *pip, 1131 xfs_inode_t *pip,
1132 mode_t mode, 1132 mode_t mode,
1133 nlink_t nlink, 1133 xfs_nlink_t nlink,
1134 xfs_dev_t rdev, 1134 xfs_dev_t rdev,
1135 cred_t *cr, 1135 cred_t *cr,
1136 xfs_prid_t prid, 1136 xfs_prid_t prid,
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index a53b1ccf6070..37e1c316f3b6 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -495,9 +495,9 @@ int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
495int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 495int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
496 xfs_inode_t **, xfs_daddr_t); 496 xfs_inode_t **, xfs_daddr_t);
497int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); 497int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
498int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t, 498int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
499 xfs_dev_t, struct cred *, xfs_prid_t, int, 499 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
500 struct xfs_buf **, boolean_t *, xfs_inode_t **); 500 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
501void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, 501void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *,
502 int); 502 int);
503uint xfs_ip2xflags(struct xfs_inode *); 503uint xfs_ip2xflags(struct xfs_inode *);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 3826e8f0e28a..469e1a7939d4 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -278,7 +278,9 @@ phase2:
278 switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) { 278 switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) {
279 case BMAPI_WRITE: 279 case BMAPI_WRITE:
280 /* If we found an extent, return it */ 280 /* If we found an extent, return it */
281 if (nimaps && (imap.br_startblock != HOLESTARTBLOCK)) { 281 if (nimaps &&
282 (imap.br_startblock != HOLESTARTBLOCK) &&
283 (imap.br_startblock != DELAYSTARTBLOCK)) {
282 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io, 284 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, io,
283 offset, count, iomapp, &imap, flags); 285 offset, count, iomapp, &imap, flags);
284 break; 286 break;
@@ -308,7 +310,8 @@ phase2:
308 break; 310 break;
309 } 311 }
310 312
311 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, &imap, &nimaps); 313 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count,
314 &imap, &nimaps);
312 break; 315 break;
313 case BMAPI_UNWRITTEN: 316 case BMAPI_UNWRITTEN:
314 lockmode = 0; 317 lockmode = 0;
@@ -365,7 +368,7 @@ xfs_flush_space(
365int 368int
366xfs_iomap_write_direct( 369xfs_iomap_write_direct(
367 xfs_inode_t *ip, 370 xfs_inode_t *ip,
368 loff_t offset, 371 xfs_off_t offset,
369 size_t count, 372 size_t count,
370 int flags, 373 int flags,
371 xfs_bmbt_irec_t *ret_imap, 374 xfs_bmbt_irec_t *ret_imap,
@@ -541,7 +544,7 @@ error_out:
541int 544int
542xfs_iomap_write_delay( 545xfs_iomap_write_delay(
543 xfs_inode_t *ip, 546 xfs_inode_t *ip,
544 loff_t offset, 547 xfs_off_t offset,
545 size_t count, 548 size_t count,
546 int ioflag, 549 int ioflag,
547 xfs_bmbt_irec_t *ret_imap, 550 xfs_bmbt_irec_t *ret_imap,
@@ -746,6 +749,8 @@ write_map:
746int 749int
747xfs_iomap_write_allocate( 750xfs_iomap_write_allocate(
748 xfs_inode_t *ip, 751 xfs_inode_t *ip,
752 xfs_off_t offset,
753 size_t count,
749 xfs_bmbt_irec_t *map, 754 xfs_bmbt_irec_t *map,
750 int *retmap) 755 int *retmap)
751{ 756{
@@ -770,9 +775,9 @@ xfs_iomap_write_allocate(
770 if ((error = XFS_QM_DQATTACH(mp, ip, 0))) 775 if ((error = XFS_QM_DQATTACH(mp, ip, 0)))
771 return XFS_ERROR(error); 776 return XFS_ERROR(error);
772 777
773 offset_fsb = map->br_startoff; 778 offset_fsb = XFS_B_TO_FSBT(mp, offset);
774 count_fsb = map->br_blockcount; 779 count_fsb = map->br_blockcount;
775 map_start_fsb = offset_fsb; 780 map_start_fsb = map->br_startoff;
776 781
777 XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); 782 XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb));
778 783
@@ -868,9 +873,9 @@ xfs_iomap_write_allocate(
868 imap[i].br_startoff, 873 imap[i].br_startoff,
869 imap[i].br_blockcount,imap[i].br_state); 874 imap[i].br_blockcount,imap[i].br_state);
870 } 875 }
871 if ((map->br_startoff >= imap[i].br_startoff) && 876 if ((offset_fsb >= imap[i].br_startoff) &&
872 (map->br_startoff < (imap[i].br_startoff + 877 (offset_fsb < (imap[i].br_startoff +
873 imap[i].br_blockcount))) { 878 imap[i].br_blockcount))) {
874 *map = imap[i]; 879 *map = imap[i];
875 *retmap = 1; 880 *retmap = 1;
876 XFS_STATS_INC(xs_xstrat_quick); 881 XFS_STATS_INC(xs_xstrat_quick);
@@ -883,9 +888,8 @@ xfs_iomap_write_allocate(
883 * file, just surrounding data, try again. 888 * file, just surrounding data, try again.
884 */ 889 */
885 nimaps--; 890 nimaps--;
886 offset_fsb = imap[nimaps].br_startoff + 891 map_start_fsb = imap[nimaps].br_startoff +
887 imap[nimaps].br_blockcount; 892 imap[nimaps].br_blockcount;
888 map_start_fsb = offset_fsb;
889 } 893 }
890 894
891trans_cancel: 895trans_cancel:
@@ -899,7 +903,7 @@ error0:
899int 903int
900xfs_iomap_write_unwritten( 904xfs_iomap_write_unwritten(
901 xfs_inode_t *ip, 905 xfs_inode_t *ip,
902 loff_t offset, 906 xfs_off_t offset,
903 size_t count) 907 size_t count)
904{ 908{
905 xfs_mount_t *mp = ip->i_mount; 909 xfs_mount_t *mp = ip->i_mount;
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index 31c91087cb33..4daaa5212102 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2003,2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as 5 * under the terms of version 2 of the GNU General Public License as
@@ -29,9 +29,6 @@
29 * 29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 31 */
32
33
34
35#ifndef __XFS_IOMAP_H__ 32#ifndef __XFS_IOMAP_H__
36#define __XFS_IOMAP_H__ 33#define __XFS_IOMAP_H__
37 34
@@ -56,7 +53,7 @@ typedef enum {
56 BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */ 53 BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
57 /* modifiers */ 54 /* modifiers */
58 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */ 55 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
59 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */ 56 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */
60 BMAPI_MMAP = (1 << 6), /* allocate for mmap write */ 57 BMAPI_MMAP = (1 << 6), /* allocate for mmap write */
61 BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */ 58 BMAPI_SYNC = (1 << 7), /* sync write to flush delalloc space */
62 BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */ 59 BMAPI_TRYLOCK = (1 << 8), /* non-blocking request */
@@ -67,13 +64,13 @@ typedef enum {
67/* 64/*
68 * xfs_iomap_t: File system I/O map 65 * xfs_iomap_t: File system I/O map
69 * 66 *
70 * The iomap_bn field is expressed in 512-byte blocks, and is where the 67 * The iomap_bn field is expressed in 512-byte blocks, and is where the
71 * mapping starts on disk. 68 * mapping starts on disk.
72 * 69 *
73 * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes. 70 * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes.
74 * iomap_offset is the offset of the mapping in the file itself. 71 * iomap_offset is the offset of the mapping in the file itself.
75 * iomap_bsize is the size of the mapping, iomap_delta is the 72 * iomap_bsize is the size of the mapping, iomap_delta is the
76 * desired data's offset into the mapping, given the offset supplied 73 * desired data's offset into the mapping, given the offset supplied
77 * to the file I/O map routine. 74 * to the file I/O map routine.
78 * 75 *
79 * When a request is made to read beyond the logical end of the object, 76 * When a request is made to read beyond the logical end of the object,
@@ -84,8 +81,8 @@ typedef enum {
84typedef struct xfs_iomap { 81typedef struct xfs_iomap {
85 xfs_daddr_t iomap_bn; /* first 512b blk of mapping */ 82 xfs_daddr_t iomap_bn; /* first 512b blk of mapping */
86 xfs_buftarg_t *iomap_target; 83 xfs_buftarg_t *iomap_target;
87 loff_t iomap_offset; /* offset of mapping, bytes */ 84 xfs_off_t iomap_offset; /* offset of mapping, bytes */
88 loff_t iomap_bsize; /* size of mapping, bytes */ 85 xfs_off_t iomap_bsize; /* size of mapping, bytes */
89 size_t iomap_delta; /* offset into mapping, bytes */ 86 size_t iomap_delta; /* offset into mapping, bytes */
90 iomap_flags_t iomap_flags; 87 iomap_flags_t iomap_flags;
91} xfs_iomap_t; 88} xfs_iomap_t;
@@ -96,12 +93,12 @@ struct xfs_bmbt_irec;
96 93
97extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int, 94extern int xfs_iomap(struct xfs_iocore *, xfs_off_t, ssize_t, int,
98 struct xfs_iomap *, int *); 95 struct xfs_iomap *, int *);
99extern int xfs_iomap_write_direct(struct xfs_inode *, loff_t, size_t, 96extern int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
100 int, struct xfs_bmbt_irec *, int *, int); 97 int, struct xfs_bmbt_irec *, int *, int);
101extern int xfs_iomap_write_delay(struct xfs_inode *, loff_t, size_t, int, 98extern int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t, int,
102 struct xfs_bmbt_irec *, int *); 99 struct xfs_bmbt_irec *, int *);
103extern int xfs_iomap_write_allocate(struct xfs_inode *, 100extern int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t,
104 struct xfs_bmbt_irec *, int *); 101 struct xfs_bmbt_irec *, int *);
105extern int xfs_iomap_write_unwritten(struct xfs_inode *, loff_t, size_t); 102extern int xfs_iomap_write_unwritten(struct xfs_inode *, xfs_off_t, size_t);
106 103
107#endif /* __XFS_IOMAP_H__*/ 104#endif /* __XFS_IOMAP_H__*/
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index b57423caef9b..2ec967d93e5a 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -301,6 +301,15 @@ xfs_mount_validate_sb(
301 } 301 }
302 302
303 /* 303 /*
304 * Version 1 directory format has never worked on Linux.
305 */
306 if (unlikely(!XFS_SB_VERSION_HASDIRV2(sbp))) {
307 cmn_err(CE_WARN,
308 "XFS: Attempted to mount file system using version 1 directory format");
309 return XFS_ERROR(ENOSYS);
310 }
311
312 /*
304 * Until this is fixed only page-sized or smaller data blocks work. 313 * Until this is fixed only page-sized or smaller data blocks work.
305 */ 314 */
306 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) { 315 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 5fc6201dd8e2..30dd08fb9f57 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -210,15 +210,16 @@ typedef int (*xfs_bmapi_t)(struct xfs_trans *, void *,
210 struct xfs_bmap_free *); 210 struct xfs_bmap_free *);
211typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *); 211typedef int (*xfs_bmap_eof_t)(void *, xfs_fileoff_t, int, int *);
212typedef int (*xfs_iomap_write_direct_t)( 212typedef int (*xfs_iomap_write_direct_t)(
213 void *, loff_t, size_t, int, 213 void *, xfs_off_t, size_t, int,
214 struct xfs_bmbt_irec *, int *, int); 214 struct xfs_bmbt_irec *, int *, int);
215typedef int (*xfs_iomap_write_delay_t)( 215typedef int (*xfs_iomap_write_delay_t)(
216 void *, loff_t, size_t, int, 216 void *, xfs_off_t, size_t, int,
217 struct xfs_bmbt_irec *, int *); 217 struct xfs_bmbt_irec *, int *);
218typedef int (*xfs_iomap_write_allocate_t)( 218typedef int (*xfs_iomap_write_allocate_t)(
219 void *, struct xfs_bmbt_irec *, int *); 219 void *, xfs_off_t, size_t,
220 struct xfs_bmbt_irec *, int *);
220typedef int (*xfs_iomap_write_unwritten_t)( 221typedef int (*xfs_iomap_write_unwritten_t)(
221 void *, loff_t, size_t); 222 void *, xfs_off_t, size_t);
222typedef uint (*xfs_lck_map_shared_t)(void *); 223typedef uint (*xfs_lck_map_shared_t)(void *);
223typedef void (*xfs_lock_t)(void *, uint); 224typedef void (*xfs_lock_t)(void *, uint);
224typedef void (*xfs_lock_demote_t)(void *, uint); 225typedef void (*xfs_lock_demote_t)(void *, uint);
@@ -258,9 +259,9 @@ typedef struct xfs_ioops {
258#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \ 259#define XFS_IOMAP_WRITE_DELAY(mp, io, offset, count, flags, mval, nmap) \
259 (*(mp)->m_io_ops.xfs_iomap_write_delay) \ 260 (*(mp)->m_io_ops.xfs_iomap_write_delay) \
260 ((io)->io_obj, offset, count, flags, mval, nmap) 261 ((io)->io_obj, offset, count, flags, mval, nmap)
261#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, mval, nmap) \ 262#define XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, mval, nmap) \
262 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \ 263 (*(mp)->m_io_ops.xfs_iomap_write_allocate) \
263 ((io)->io_obj, mval, nmap) 264 ((io)->io_obj, offset, count, mval, nmap)
264#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \ 265#define XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count) \
265 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \ 266 (*(mp)->m_io_ops.xfs_iomap_write_unwritten) \
266 ((io)->io_obj, offset, count) 267 ((io)->io_obj, offset, count)
@@ -428,10 +429,10 @@ typedef struct xfs_mount {
428#define XFS_WRITEIO_LOG_LARGE 16 429#define XFS_WRITEIO_LOG_LARGE 16
429 430
430/* 431/*
431 * Max and min values for UIO and mount-option defined I/O sizes; 432 * Max and min values for mount-option defined I/O
432 * min value can't be less than a page. Currently unused. 433 * preallocation sizes.
433 */ 434 */
434#define XFS_MAX_IO_LOG 16 /* 64K */ 435#define XFS_MAX_IO_LOG 30 /* 1G */
435#define XFS_MIN_IO_LOG PAGE_SHIFT 436#define XFS_MIN_IO_LOG PAGE_SHIFT
436 437
437/* 438/*
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 04609d27ea51..e4bf711e48ff 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -63,6 +63,7 @@ typedef __u64 xfs_ino_t; /* <inode> type */
63typedef __s64 xfs_daddr_t; /* <disk address> type */ 63typedef __s64 xfs_daddr_t; /* <disk address> type */
64typedef char * xfs_caddr_t; /* <core address> type */ 64typedef char * xfs_caddr_t; /* <core address> type */
65typedef __u32 xfs_dev_t; 65typedef __u32 xfs_dev_t;
66typedef __u32 xfs_nlink_t;
66 67
67/* __psint_t is the same size as a pointer */ 68/* __psint_t is the same size as a pointer */
68#if (BITS_PER_LONG == 32) 69#if (BITS_PER_LONG == 32)
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 816b945fa0ea..d1f8146a06ea 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -147,7 +147,7 @@ xfs_dir_ialloc(
147 xfs_inode_t *dp, /* directory within whose allocate 147 xfs_inode_t *dp, /* directory within whose allocate
148 the inode. */ 148 the inode. */
149 mode_t mode, 149 mode_t mode,
150 nlink_t nlink, 150 xfs_nlink_t nlink,
151 xfs_dev_t rdev, 151 xfs_dev_t rdev,
152 cred_t *credp, 152 cred_t *credp,
153 prid_t prid, /* project id */ 153 prid_t prid, /* project id */
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h
index e1ed6a588000..01d98b4b7af7 100644
--- a/fs/xfs/xfs_utils.h
+++ b/fs/xfs/xfs_utils.h
@@ -42,7 +42,7 @@ extern int xfs_get_dir_entry (vname_t *, xfs_inode_t **);
42extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *, 42extern int xfs_dir_lookup_int (bhv_desc_t *, uint, vname_t *, xfs_ino_t *,
43 xfs_inode_t **); 43 xfs_inode_t **);
44extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *); 44extern int xfs_truncate_file (xfs_mount_t *, xfs_inode_t *);
45extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, nlink_t, 45extern int xfs_dir_ialloc (xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t,
46 xfs_dev_t, cred_t *, prid_t, int, 46 xfs_dev_t, cred_t *, prid_t, int,
47 xfs_inode_t **, int *); 47 xfs_inode_t **, int *);
48extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *); 48extern int xfs_droplink (xfs_trans_t *, xfs_inode_t *);
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 00aae9c6a904..b53736650100 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1649,6 +1649,7 @@ xfs_vget(
1649#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */ 1649#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */
1650#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */ 1650#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */
1651#define MNTOPT_MTPT "mtpt" /* filesystem mount point */ 1651#define MNTOPT_MTPT "mtpt" /* filesystem mount point */
1652#define MNTOPT_ALLOCSIZE "allocsize" /* preferred allocation size */
1652#define MNTOPT_IHASHSIZE "ihashsize" /* size of inode hash table */ 1653#define MNTOPT_IHASHSIZE "ihashsize" /* size of inode hash table */
1653#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ 1654#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
1654#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */ 1655#define MNTOPT_NOLOGFLUSH "nologflush" /* don't hard flush on log writes */
@@ -1657,6 +1658,28 @@ xfs_vget(
1657#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */ 1658#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */
1658#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */ 1659#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */
1659 1660
1661STATIC unsigned long
1662suffix_strtoul(const char *cp, char **endp, unsigned int base)
1663{
1664 int last, shift_left_factor = 0;
1665 char *value = (char *)cp;
1666
1667 last = strlen(value) - 1;
1668 if (value[last] == 'K' || value[last] == 'k') {
1669 shift_left_factor = 10;
1670 value[last] = '\0';
1671 }
1672 if (value[last] == 'M' || value[last] == 'm') {
1673 shift_left_factor = 20;
1674 value[last] = '\0';
1675 }
1676 if (value[last] == 'G' || value[last] == 'g') {
1677 shift_left_factor = 30;
1678 value[last] = '\0';
1679 }
1680
1681 return simple_strtoul(cp, endp, base) << shift_left_factor;
1682}
1660 1683
1661int 1684int
1662xfs_parseargs( 1685xfs_parseargs(
@@ -1688,60 +1711,60 @@ xfs_parseargs(
1688 if (!strcmp(this_char, MNTOPT_LOGBUFS)) { 1711 if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
1689 if (!value || !*value) { 1712 if (!value || !*value) {
1690 printk("XFS: %s option requires an argument\n", 1713 printk("XFS: %s option requires an argument\n",
1691 MNTOPT_LOGBUFS); 1714 this_char);
1692 return EINVAL; 1715 return EINVAL;
1693 } 1716 }
1694 args->logbufs = simple_strtoul(value, &eov, 10); 1717 args->logbufs = simple_strtoul(value, &eov, 10);
1695 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { 1718 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
1696 int last, in_kilobytes = 0;
1697
1698 if (!value || !*value) { 1719 if (!value || !*value) {
1699 printk("XFS: %s option requires an argument\n", 1720 printk("XFS: %s option requires an argument\n",
1700 MNTOPT_LOGBSIZE); 1721 this_char);
1701 return EINVAL; 1722 return EINVAL;
1702 } 1723 }
1703 last = strlen(value) - 1; 1724 args->logbufsize = suffix_strtoul(value, &eov, 10);
1704 if (value[last] == 'K' || value[last] == 'k') {
1705 in_kilobytes = 1;
1706 value[last] = '\0';
1707 }
1708 args->logbufsize = simple_strtoul(value, &eov, 10);
1709 if (in_kilobytes)
1710 args->logbufsize <<= 10;
1711 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { 1725 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
1712 if (!value || !*value) { 1726 if (!value || !*value) {
1713 printk("XFS: %s option requires an argument\n", 1727 printk("XFS: %s option requires an argument\n",
1714 MNTOPT_LOGDEV); 1728 this_char);
1715 return EINVAL; 1729 return EINVAL;
1716 } 1730 }
1717 strncpy(args->logname, value, MAXNAMELEN); 1731 strncpy(args->logname, value, MAXNAMELEN);
1718 } else if (!strcmp(this_char, MNTOPT_MTPT)) { 1732 } else if (!strcmp(this_char, MNTOPT_MTPT)) {
1719 if (!value || !*value) { 1733 if (!value || !*value) {
1720 printk("XFS: %s option requires an argument\n", 1734 printk("XFS: %s option requires an argument\n",
1721 MNTOPT_MTPT); 1735 this_char);
1722 return EINVAL; 1736 return EINVAL;
1723 } 1737 }
1724 strncpy(args->mtpt, value, MAXNAMELEN); 1738 strncpy(args->mtpt, value, MAXNAMELEN);
1725 } else if (!strcmp(this_char, MNTOPT_RTDEV)) { 1739 } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
1726 if (!value || !*value) { 1740 if (!value || !*value) {
1727 printk("XFS: %s option requires an argument\n", 1741 printk("XFS: %s option requires an argument\n",
1728 MNTOPT_RTDEV); 1742 this_char);
1729 return EINVAL; 1743 return EINVAL;
1730 } 1744 }
1731 strncpy(args->rtname, value, MAXNAMELEN); 1745 strncpy(args->rtname, value, MAXNAMELEN);
1732 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { 1746 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
1733 if (!value || !*value) { 1747 if (!value || !*value) {
1734 printk("XFS: %s option requires an argument\n", 1748 printk("XFS: %s option requires an argument\n",
1735 MNTOPT_BIOSIZE); 1749 this_char);
1736 return EINVAL; 1750 return EINVAL;
1737 } 1751 }
1738 iosize = simple_strtoul(value, &eov, 10); 1752 iosize = simple_strtoul(value, &eov, 10);
1739 args->flags |= XFSMNT_IOSIZE; 1753 args->flags |= XFSMNT_IOSIZE;
1740 args->iosizelog = (uint8_t) iosize; 1754 args->iosizelog = (uint8_t) iosize;
1755 } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
1756 if (!value || !*value) {
1757 printk("XFS: %s option requires an argument\n",
1758 this_char);
1759 return EINVAL;
1760 }
1761 iosize = suffix_strtoul(value, &eov, 10);
1762 args->flags |= XFSMNT_IOSIZE;
1763 args->iosizelog = ffs(iosize) - 1;
1741 } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) { 1764 } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) {
1742 if (!value || !*value) { 1765 if (!value || !*value) {
1743 printk("XFS: %s option requires an argument\n", 1766 printk("XFS: %s option requires an argument\n",
1744 this_char); 1767 this_char);
1745 return EINVAL; 1768 return EINVAL;
1746 } 1769 }
1747 args->flags |= XFSMNT_IHASHSIZE; 1770 args->flags |= XFSMNT_IHASHSIZE;
@@ -1756,7 +1779,7 @@ xfs_parseargs(
1756 args->flags |= XFSMNT_INO64; 1779 args->flags |= XFSMNT_INO64;
1757#if !XFS_BIG_INUMS 1780#if !XFS_BIG_INUMS
1758 printk("XFS: %s option not allowed on this system\n", 1781 printk("XFS: %s option not allowed on this system\n",
1759 MNTOPT_INO64); 1782 this_char);
1760 return EINVAL; 1783 return EINVAL;
1761#endif 1784#endif
1762 } else if (!strcmp(this_char, MNTOPT_NOALIGN)) { 1785 } else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
@@ -1766,14 +1789,14 @@ xfs_parseargs(
1766 } else if (!strcmp(this_char, MNTOPT_SUNIT)) { 1789 } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
1767 if (!value || !*value) { 1790 if (!value || !*value) {
1768 printk("XFS: %s option requires an argument\n", 1791 printk("XFS: %s option requires an argument\n",
1769 MNTOPT_SUNIT); 1792 this_char);
1770 return EINVAL; 1793 return EINVAL;
1771 } 1794 }
1772 dsunit = simple_strtoul(value, &eov, 10); 1795 dsunit = simple_strtoul(value, &eov, 10);
1773 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { 1796 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
1774 if (!value || !*value) { 1797 if (!value || !*value) {
1775 printk("XFS: %s option requires an argument\n", 1798 printk("XFS: %s option requires an argument\n",
1776 MNTOPT_SWIDTH); 1799 this_char);
1777 return EINVAL; 1800 return EINVAL;
1778 } 1801 }
1779 dswidth = simple_strtoul(value, &eov, 10); 1802 dswidth = simple_strtoul(value, &eov, 10);
@@ -1781,7 +1804,7 @@ xfs_parseargs(
1781 args->flags &= ~XFSMNT_32BITINODES; 1804 args->flags &= ~XFSMNT_32BITINODES;
1782#if !XFS_BIG_INUMS 1805#if !XFS_BIG_INUMS
1783 printk("XFS: %s option not allowed on this system\n", 1806 printk("XFS: %s option not allowed on this system\n",
1784 MNTOPT_64BITINODE); 1807 this_char);
1785 return EINVAL; 1808 return EINVAL;
1786#endif 1809#endif
1787 } else if (!strcmp(this_char, MNTOPT_NOUUID)) { 1810 } else if (!strcmp(this_char, MNTOPT_NOUUID)) {
@@ -1877,7 +1900,7 @@ xfs_showargs(
1877 seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize); 1900 seq_printf(m, "," MNTOPT_IHASHSIZE "=%d", mp->m_ihsize);
1878 1901
1879 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) 1902 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
1880 seq_printf(m, "," MNTOPT_BIOSIZE "=%d", mp->m_writeio_log); 1903 seq_printf(m, "," MNTOPT_ALLOCSIZE "=%d", 1<<mp->m_writeio_log);
1881 1904
1882 if (mp->m_logbufs > 0) 1905 if (mp->m_logbufs > 0)
1883 seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs); 1906 seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 70092963ca9e..25a526629b12 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -305,7 +305,7 @@ xfs_setattr(
305 int mandlock_before, mandlock_after; 305 int mandlock_before, mandlock_after;
306 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 306 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
307 int file_owner; 307 int file_owner;
308 int need_iolock = (flags & ATTR_DMI) == 0; 308 int need_iolock = 1;
309 309
310 vp = BHV_TO_VNODE(bdp); 310 vp = BHV_TO_VNODE(bdp);
311 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 311 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
@@ -384,6 +384,9 @@ xfs_setattr(
384 */ 384 */
385 tp = NULL; 385 tp = NULL;
386 lock_flags = XFS_ILOCK_EXCL; 386 lock_flags = XFS_ILOCK_EXCL;
387 ASSERT(flags & ATTR_NOLOCK ? flags & ATTR_DMI : 1);
388 if (flags & ATTR_NOLOCK)
389 need_iolock = 0;
387 if (!(mask & XFS_AT_SIZE)) { 390 if (!(mask & XFS_AT_SIZE)) {
388 if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || 391 if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) ||
389 (mp->m_flags & XFS_MOUNT_WSYNC)) { 392 (mp->m_flags & XFS_MOUNT_WSYNC)) {
@@ -4320,7 +4323,7 @@ xfs_free_file_space(
4320 int rt; 4323 int rt;
4321 xfs_fileoff_t startoffset_fsb; 4324 xfs_fileoff_t startoffset_fsb;
4322 xfs_trans_t *tp; 4325 xfs_trans_t *tp;
4323 int need_iolock = (attr_flags & ATTR_DMI) == 0; 4326 int need_iolock = 1;
4324 4327
4325 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 4328 vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address);
4326 mp = ip->i_mount; 4329 mp = ip->i_mount;
@@ -4348,8 +4351,12 @@ xfs_free_file_space(
4348 return(error); 4351 return(error);
4349 } 4352 }
4350 4353
4354 ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1);
4355 if (attr_flags & ATTR_NOLOCK)
4356 need_iolock = 0;
4351 if (need_iolock) 4357 if (need_iolock)
4352 xfs_ilock(ip, XFS_IOLOCK_EXCL); 4358 xfs_ilock(ip, XFS_IOLOCK_EXCL);
4359
4353 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), 4360 rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog),
4354 (__uint8_t)NBPP); 4361 (__uint8_t)NBPP);
4355 ilen = len + (offset & (rounding - 1)); 4362 ilen = len + (offset & (rounding - 1));