diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:36:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:36:55 -0400 |
commit | c0341b0f47722fbe5ab45f436fc6ddc1c58c0a6f (patch) | |
tree | 63279f95e7250a3c465eb061be97fff071d0903b /fs/xfs/linux-2.6 | |
parent | ae1390d8c3e2142e5cf6d192951d6e2b1fa213c5 (diff) | |
parent | 1b06e7926694178e146ff708b2c15a6da64c9765 (diff) |
Merge git://oss.sgi.com:8090/xfs/xfs-2.6
* git://oss.sgi.com:8090/xfs/xfs-2.6: (49 commits)
[XFS] Remove v1 dir trace macro - missed in a past commit.
[XFS] 955947: Infinite loop in xfs_bulkstat() on formatter() error
[XFS] pv 956241, author: nathans, rv: vapo - make ino validation checks
[XFS] pv 956240, author: nathans, rv: vapo - Minor fixes in
[XFS] Really fix use after free in xfs_iunpin.
[XFS] Collapse sv_init and init_sv into just the one interface.
[XFS] standardize on one sema init macro
[XFS] Reduce endian flipping in alloc_btree, same as was done for
[XFS] Minor cleanup from dio locking fix, remove an extra conditional.
[XFS] Fix kmem_zalloc_greedy warnings on 64 bit platforms.
[XFS] pv 955157, rv bnaujok - break the loop on EFAULT formatter() error
[XFS] pv 955157, rv bnaujok - break the loop on formatter() error
[XFS] Fixes the leak in reservation space because we weren't ungranting
[XFS] Add lock annotations to xfs_trans_update_ail and
[XFS] Fix a porting botch on the realtime subvol growfs code path.
[XFS] Minor code rearranging and cleanup to prevent some coverity false
[XFS] Remove a no-longer-correct debug assert from dio completion
[XFS] Add a greedy allocation interface, allocating within a min/max size
[XFS] Improve error handling for the zero-fsblock extent detection code.
[XFS] Be more defensive with page flags (error/private) for metadata
...
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 29 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/sema.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/sv.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 51 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 7 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_globals.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 19 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 25 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 14 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 10 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vfs.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 2 |
15 files changed, 110 insertions, 72 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index aba7fcf881a2..d59737589815 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -34,6 +34,14 @@ kmem_alloc(size_t size, unsigned int __nocast flags) | |||
34 | gfp_t lflags = kmem_flags_convert(flags); | 34 | gfp_t lflags = kmem_flags_convert(flags); |
35 | void *ptr; | 35 | void *ptr; |
36 | 36 | ||
37 | #ifdef DEBUG | ||
38 | if (unlikely(!(flags & KM_LARGE) && (size > PAGE_SIZE))) { | ||
39 | printk(KERN_WARNING "Large %s attempt, size=%ld\n", | ||
40 | __FUNCTION__, (long)size); | ||
41 | dump_stack(); | ||
42 | } | ||
43 | #endif | ||
44 | |||
37 | do { | 45 | do { |
38 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) | 46 | if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS) |
39 | ptr = kmalloc(size, lflags); | 47 | ptr = kmalloc(size, lflags); |
@@ -60,6 +68,27 @@ kmem_zalloc(size_t size, unsigned int __nocast flags) | |||
60 | return ptr; | 68 | return ptr; |
61 | } | 69 | } |
62 | 70 | ||
71 | void * | ||
72 | kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize, | ||
73 | unsigned int __nocast flags) | ||
74 | { | ||
75 | void *ptr; | ||
76 | size_t kmsize = maxsize; | ||
77 | unsigned int kmflags = (flags & ~KM_SLEEP) | KM_NOSLEEP; | ||
78 | |||
79 | while (!(ptr = kmem_zalloc(kmsize, kmflags))) { | ||
80 | if ((kmsize <= minsize) && (flags & KM_NOSLEEP)) | ||
81 | break; | ||
82 | if ((kmsize >>= 1) <= minsize) { | ||
83 | kmsize = minsize; | ||
84 | kmflags = flags; | ||
85 | } | ||
86 | } | ||
87 | if (ptr) | ||
88 | *size = kmsize; | ||
89 | return ptr; | ||
90 | } | ||
91 | |||
63 | void | 92 | void |
64 | kmem_free(void *ptr, size_t size) | 93 | kmem_free(void *ptr, size_t size) |
65 | { | 94 | { |
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index 0e8293c5a32f..9ebabdf7829c 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define KM_NOSLEEP 0x0002u | 30 | #define KM_NOSLEEP 0x0002u |
31 | #define KM_NOFS 0x0004u | 31 | #define KM_NOFS 0x0004u |
32 | #define KM_MAYFAIL 0x0008u | 32 | #define KM_MAYFAIL 0x0008u |
33 | #define KM_LARGE 0x0010u | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * We use a special process flag to avoid recursive callbacks into | 36 | * We use a special process flag to avoid recursive callbacks into |
@@ -41,7 +42,7 @@ kmem_flags_convert(unsigned int __nocast flags) | |||
41 | { | 42 | { |
42 | gfp_t lflags; | 43 | gfp_t lflags; |
43 | 44 | ||
44 | BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL)); | 45 | BUG_ON(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL|KM_LARGE)); |
45 | 46 | ||
46 | if (flags & KM_NOSLEEP) { | 47 | if (flags & KM_NOSLEEP) { |
47 | lflags = GFP_ATOMIC | __GFP_NOWARN; | 48 | lflags = GFP_ATOMIC | __GFP_NOWARN; |
@@ -54,8 +55,9 @@ kmem_flags_convert(unsigned int __nocast flags) | |||
54 | } | 55 | } |
55 | 56 | ||
56 | extern void *kmem_alloc(size_t, unsigned int __nocast); | 57 | extern void *kmem_alloc(size_t, unsigned int __nocast); |
57 | extern void *kmem_realloc(void *, size_t, size_t, unsigned int __nocast); | ||
58 | extern void *kmem_zalloc(size_t, unsigned int __nocast); | 58 | extern void *kmem_zalloc(size_t, unsigned int __nocast); |
59 | extern void *kmem_zalloc_greedy(size_t *, size_t, size_t, unsigned int __nocast); | ||
60 | extern void *kmem_realloc(void *, size_t, size_t, unsigned int __nocast); | ||
59 | extern void kmem_free(void *, size_t); | 61 | extern void kmem_free(void *, size_t); |
60 | 62 | ||
61 | /* | 63 | /* |
diff --git a/fs/xfs/linux-2.6/sema.h b/fs/xfs/linux-2.6/sema.h index b25090094cca..2009e6d922ce 100644 --- a/fs/xfs/linux-2.6/sema.h +++ b/fs/xfs/linux-2.6/sema.h | |||
@@ -29,8 +29,6 @@ | |||
29 | 29 | ||
30 | typedef struct semaphore sema_t; | 30 | typedef struct semaphore sema_t; |
31 | 31 | ||
32 | #define init_sema(sp, val, c, d) sema_init(sp, val) | ||
33 | #define initsema(sp, val) sema_init(sp, val) | ||
34 | #define initnsema(sp, val, name) sema_init(sp, val) | 32 | #define initnsema(sp, val, name) sema_init(sp, val) |
35 | #define psema(sp, b) down(sp) | 33 | #define psema(sp, b) down(sp) |
36 | #define vsema(sp) up(sp) | 34 | #define vsema(sp) up(sp) |
diff --git a/fs/xfs/linux-2.6/sv.h b/fs/xfs/linux-2.6/sv.h index 9a8ad481b008..351a8f454bd1 100644 --- a/fs/xfs/linux-2.6/sv.h +++ b/fs/xfs/linux-2.6/sv.h | |||
@@ -53,8 +53,6 @@ static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state, | |||
53 | remove_wait_queue(&sv->waiters, &wait); | 53 | remove_wait_queue(&sv->waiters, &wait); |
54 | } | 54 | } |
55 | 55 | ||
56 | #define init_sv(sv,type,name,flag) \ | ||
57 | init_waitqueue_head(&(sv)->waiters) | ||
58 | #define sv_init(sv,flag,name) \ | 56 | #define sv_init(sv,flag,name) \ |
59 | init_waitqueue_head(&(sv)->waiters) | 57 | init_waitqueue_head(&(sv)->waiters) |
60 | #define sv_destroy(sv) \ | 58 | #define sv_destroy(sv) \ |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 34dcb43a7837..09360cf1e1f2 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -71,7 +71,7 @@ xfs_page_trace( | |||
71 | int tag, | 71 | int tag, |
72 | struct inode *inode, | 72 | struct inode *inode, |
73 | struct page *page, | 73 | struct page *page, |
74 | int mask) | 74 | unsigned long pgoff) |
75 | { | 75 | { |
76 | xfs_inode_t *ip; | 76 | xfs_inode_t *ip; |
77 | bhv_vnode_t *vp = vn_from_inode(inode); | 77 | bhv_vnode_t *vp = vn_from_inode(inode); |
@@ -91,7 +91,7 @@ xfs_page_trace( | |||
91 | (void *)ip, | 91 | (void *)ip, |
92 | (void *)inode, | 92 | (void *)inode, |
93 | (void *)page, | 93 | (void *)page, |
94 | (void *)((unsigned long)mask), | 94 | (void *)pgoff, |
95 | (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)), | 95 | (void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)), |
96 | (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)), | 96 | (void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)), |
97 | (void *)((unsigned long)((isize >> 32) & 0xffffffff)), | 97 | (void *)((unsigned long)((isize >> 32) & 0xffffffff)), |
@@ -105,7 +105,7 @@ xfs_page_trace( | |||
105 | (void *)NULL); | 105 | (void *)NULL); |
106 | } | 106 | } |
107 | #else | 107 | #else |
108 | #define xfs_page_trace(tag, inode, page, mask) | 108 | #define xfs_page_trace(tag, inode, page, pgoff) |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | /* | 111 | /* |
@@ -1197,7 +1197,7 @@ xfs_vm_releasepage( | |||
1197 | .nr_to_write = 1, | 1197 | .nr_to_write = 1, |
1198 | }; | 1198 | }; |
1199 | 1199 | ||
1200 | xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, gfp_mask); | 1200 | xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, 0); |
1201 | 1201 | ||
1202 | if (!page_has_buffers(page)) | 1202 | if (!page_has_buffers(page)) |
1203 | return 0; | 1203 | return 0; |
@@ -1356,7 +1356,6 @@ xfs_end_io_direct( | |||
1356 | ioend->io_size = size; | 1356 | ioend->io_size = size; |
1357 | xfs_finish_ioend(ioend); | 1357 | xfs_finish_ioend(ioend); |
1358 | } else { | 1358 | } else { |
1359 | ASSERT(size >= 0); | ||
1360 | xfs_destroy_ioend(ioend); | 1359 | xfs_destroy_ioend(ioend); |
1361 | } | 1360 | } |
1362 | 1361 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 2af528dcfb04..9bbadafdcb00 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. | 2 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | 3 | * All Rights Reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -318,8 +318,12 @@ xfs_buf_free( | |||
318 | if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) | 318 | if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) |
319 | free_address(bp->b_addr - bp->b_offset); | 319 | free_address(bp->b_addr - bp->b_offset); |
320 | 320 | ||
321 | for (i = 0; i < bp->b_page_count; i++) | 321 | for (i = 0; i < bp->b_page_count; i++) { |
322 | page_cache_release(bp->b_pages[i]); | 322 | struct page *page = bp->b_pages[i]; |
323 | |||
324 | ASSERT(!PagePrivate(page)); | ||
325 | page_cache_release(page); | ||
326 | } | ||
323 | _xfs_buf_free_pages(bp); | 327 | _xfs_buf_free_pages(bp); |
324 | } else if (bp->b_flags & _XBF_KMEM_ALLOC) { | 328 | } else if (bp->b_flags & _XBF_KMEM_ALLOC) { |
325 | /* | 329 | /* |
@@ -400,6 +404,7 @@ _xfs_buf_lookup_pages( | |||
400 | nbytes = min_t(size_t, size, PAGE_CACHE_SIZE - offset); | 404 | nbytes = min_t(size_t, size, PAGE_CACHE_SIZE - offset); |
401 | size -= nbytes; | 405 | size -= nbytes; |
402 | 406 | ||
407 | ASSERT(!PagePrivate(page)); | ||
403 | if (!PageUptodate(page)) { | 408 | if (!PageUptodate(page)) { |
404 | page_count--; | 409 | page_count--; |
405 | if (blocksize >= PAGE_CACHE_SIZE) { | 410 | if (blocksize >= PAGE_CACHE_SIZE) { |
@@ -768,7 +773,7 @@ xfs_buf_get_noaddr( | |||
768 | _xfs_buf_initialize(bp, target, 0, len, 0); | 773 | _xfs_buf_initialize(bp, target, 0, len, 0); |
769 | 774 | ||
770 | try_again: | 775 | try_again: |
771 | data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL); | 776 | data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL | KM_LARGE); |
772 | if (unlikely(data == NULL)) | 777 | if (unlikely(data == NULL)) |
773 | goto fail_free_buf; | 778 | goto fail_free_buf; |
774 | 779 | ||
@@ -1117,10 +1122,10 @@ xfs_buf_bio_end_io( | |||
1117 | do { | 1122 | do { |
1118 | struct page *page = bvec->bv_page; | 1123 | struct page *page = bvec->bv_page; |
1119 | 1124 | ||
1125 | ASSERT(!PagePrivate(page)); | ||
1120 | if (unlikely(bp->b_error)) { | 1126 | if (unlikely(bp->b_error)) { |
1121 | if (bp->b_flags & XBF_READ) | 1127 | if (bp->b_flags & XBF_READ) |
1122 | ClearPageUptodate(page); | 1128 | ClearPageUptodate(page); |
1123 | SetPageError(page); | ||
1124 | } else if (blocksize >= PAGE_CACHE_SIZE) { | 1129 | } else if (blocksize >= PAGE_CACHE_SIZE) { |
1125 | SetPageUptodate(page); | 1130 | SetPageUptodate(page); |
1126 | } else if (!PagePrivate(page) && | 1131 | } else if (!PagePrivate(page) && |
@@ -1156,16 +1161,16 @@ _xfs_buf_ioapply( | |||
1156 | total_nr_pages = bp->b_page_count; | 1161 | total_nr_pages = bp->b_page_count; |
1157 | map_i = 0; | 1162 | map_i = 0; |
1158 | 1163 | ||
1159 | if (bp->b_flags & _XBF_RUN_QUEUES) { | ||
1160 | bp->b_flags &= ~_XBF_RUN_QUEUES; | ||
1161 | rw = (bp->b_flags & XBF_READ) ? READ_SYNC : WRITE_SYNC; | ||
1162 | } else { | ||
1163 | rw = (bp->b_flags & XBF_READ) ? READ : WRITE; | ||
1164 | } | ||
1165 | |||
1166 | if (bp->b_flags & XBF_ORDERED) { | 1164 | if (bp->b_flags & XBF_ORDERED) { |
1167 | ASSERT(!(bp->b_flags & XBF_READ)); | 1165 | ASSERT(!(bp->b_flags & XBF_READ)); |
1168 | rw = WRITE_BARRIER; | 1166 | rw = WRITE_BARRIER; |
1167 | } else if (bp->b_flags & _XBF_RUN_QUEUES) { | ||
1168 | ASSERT(!(bp->b_flags & XBF_READ_AHEAD)); | ||
1169 | bp->b_flags &= ~_XBF_RUN_QUEUES; | ||
1170 | rw = (bp->b_flags & XBF_WRITE) ? WRITE_SYNC : READ_SYNC; | ||
1171 | } else { | ||
1172 | rw = (bp->b_flags & XBF_WRITE) ? WRITE : | ||
1173 | (bp->b_flags & XBF_READ_AHEAD) ? READA : READ; | ||
1169 | } | 1174 | } |
1170 | 1175 | ||
1171 | /* Special code path for reading a sub page size buffer in -- | 1176 | /* Special code path for reading a sub page size buffer in -- |
@@ -1681,6 +1686,7 @@ xfsbufd( | |||
1681 | xfs_buf_t *bp, *n; | 1686 | xfs_buf_t *bp, *n; |
1682 | struct list_head *dwq = &target->bt_delwrite_queue; | 1687 | struct list_head *dwq = &target->bt_delwrite_queue; |
1683 | spinlock_t *dwlk = &target->bt_delwrite_lock; | 1688 | spinlock_t *dwlk = &target->bt_delwrite_lock; |
1689 | int count; | ||
1684 | 1690 | ||
1685 | current->flags |= PF_MEMALLOC; | 1691 | current->flags |= PF_MEMALLOC; |
1686 | 1692 | ||
@@ -1696,6 +1702,7 @@ xfsbufd( | |||
1696 | schedule_timeout_interruptible( | 1702 | schedule_timeout_interruptible( |
1697 | xfs_buf_timer_centisecs * msecs_to_jiffies(10)); | 1703 | xfs_buf_timer_centisecs * msecs_to_jiffies(10)); |
1698 | 1704 | ||
1705 | count = 0; | ||
1699 | age = xfs_buf_age_centisecs * msecs_to_jiffies(10); | 1706 | age = xfs_buf_age_centisecs * msecs_to_jiffies(10); |
1700 | spin_lock(dwlk); | 1707 | spin_lock(dwlk); |
1701 | list_for_each_entry_safe(bp, n, dwq, b_list) { | 1708 | list_for_each_entry_safe(bp, n, dwq, b_list) { |
@@ -1711,9 +1718,11 @@ xfsbufd( | |||
1711 | break; | 1718 | break; |
1712 | } | 1719 | } |
1713 | 1720 | ||
1714 | bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q); | 1721 | bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q| |
1722 | _XBF_RUN_QUEUES); | ||
1715 | bp->b_flags |= XBF_WRITE; | 1723 | bp->b_flags |= XBF_WRITE; |
1716 | list_move(&bp->b_list, &tmp); | 1724 | list_move_tail(&bp->b_list, &tmp); |
1725 | count++; | ||
1717 | } | 1726 | } |
1718 | } | 1727 | } |
1719 | spin_unlock(dwlk); | 1728 | spin_unlock(dwlk); |
@@ -1724,12 +1733,12 @@ xfsbufd( | |||
1724 | 1733 | ||
1725 | list_del_init(&bp->b_list); | 1734 | list_del_init(&bp->b_list); |
1726 | xfs_buf_iostrategy(bp); | 1735 | xfs_buf_iostrategy(bp); |
1727 | |||
1728 | blk_run_address_space(target->bt_mapping); | ||
1729 | } | 1736 | } |
1730 | 1737 | ||
1731 | if (as_list_len > 0) | 1738 | if (as_list_len > 0) |
1732 | purge_addresses(); | 1739 | purge_addresses(); |
1740 | if (count) | ||
1741 | blk_run_address_space(target->bt_mapping); | ||
1733 | 1742 | ||
1734 | clear_bit(XBT_FORCE_FLUSH, &target->bt_flags); | 1743 | clear_bit(XBT_FORCE_FLUSH, &target->bt_flags); |
1735 | } while (!kthread_should_stop()); | 1744 | } while (!kthread_should_stop()); |
@@ -1767,7 +1776,7 @@ xfs_flush_buftarg( | |||
1767 | continue; | 1776 | continue; |
1768 | } | 1777 | } |
1769 | 1778 | ||
1770 | list_move(&bp->b_list, &tmp); | 1779 | list_move_tail(&bp->b_list, &tmp); |
1771 | } | 1780 | } |
1772 | spin_unlock(dwlk); | 1781 | spin_unlock(dwlk); |
1773 | 1782 | ||
@@ -1776,7 +1785,7 @@ xfs_flush_buftarg( | |||
1776 | */ | 1785 | */ |
1777 | list_for_each_entry_safe(bp, n, &tmp, b_list) { | 1786 | list_for_each_entry_safe(bp, n, &tmp, b_list) { |
1778 | xfs_buf_lock(bp); | 1787 | xfs_buf_lock(bp); |
1779 | bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q); | 1788 | bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q|_XBF_RUN_QUEUES); |
1780 | bp->b_flags |= XBF_WRITE; | 1789 | bp->b_flags |= XBF_WRITE; |
1781 | if (wait) | 1790 | if (wait) |
1782 | bp->b_flags &= ~XBF_ASYNC; | 1791 | bp->b_flags &= ~XBF_ASYNC; |
@@ -1786,6 +1795,9 @@ xfs_flush_buftarg( | |||
1786 | xfs_buf_iostrategy(bp); | 1795 | xfs_buf_iostrategy(bp); |
1787 | } | 1796 | } |
1788 | 1797 | ||
1798 | if (wait) | ||
1799 | blk_run_address_space(target->bt_mapping); | ||
1800 | |||
1789 | /* | 1801 | /* |
1790 | * Remaining list items must be flushed before returning | 1802 | * Remaining list items must be flushed before returning |
1791 | */ | 1803 | */ |
@@ -1797,9 +1809,6 @@ xfs_flush_buftarg( | |||
1797 | xfs_buf_relse(bp); | 1809 | xfs_buf_relse(bp); |
1798 | } | 1810 | } |
1799 | 1811 | ||
1800 | if (wait) | ||
1801 | blk_run_address_space(target->bt_mapping); | ||
1802 | |||
1803 | return pincount; | 1812 | return pincount; |
1804 | } | 1813 | } |
1805 | 1814 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 7858703ed84c..9dd235cb0107 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -298,11 +298,6 @@ extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *); | |||
298 | #define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE) | 298 | #define XFS_BUF_UNWRITE(bp) ((bp)->b_flags &= ~XBF_WRITE) |
299 | #define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE) | 299 | #define XFS_BUF_ISWRITE(bp) ((bp)->b_flags & XBF_WRITE) |
300 | 300 | ||
301 | #define XFS_BUF_ISUNINITIAL(bp) (0) | ||
302 | #define XFS_BUF_UNUNINITIAL(bp) (0) | ||
303 | |||
304 | #define XFS_BUF_BP_ISMAPPED(bp) (1) | ||
305 | |||
306 | #define XFS_BUF_IODONE_FUNC(bp) ((bp)->b_iodone) | 301 | #define XFS_BUF_IODONE_FUNC(bp) ((bp)->b_iodone) |
307 | #define XFS_BUF_SET_IODONE_FUNC(bp, func) ((bp)->b_iodone = (func)) | 302 | #define XFS_BUF_SET_IODONE_FUNC(bp, func) ((bp)->b_iodone = (func)) |
308 | #define XFS_BUF_CLR_IODONE_FUNC(bp) ((bp)->b_iodone = NULL) | 303 | #define XFS_BUF_CLR_IODONE_FUNC(bp) ((bp)->b_iodone = NULL) |
@@ -393,8 +388,6 @@ static inline int XFS_bwrite(xfs_buf_t *bp) | |||
393 | return error; | 388 | return error; |
394 | } | 389 | } |
395 | 390 | ||
396 | #define XFS_bdwrite(bp) xfs_buf_iostart(bp, XBF_DELWRI | XBF_ASYNC) | ||
397 | |||
398 | static inline int xfs_bdwrite(void *mp, xfs_buf_t *bp) | 391 | static inline int xfs_bdwrite(void *mp, xfs_buf_t *bp) |
399 | { | 392 | { |
400 | bp->b_strat = xfs_bdstrat_cb; | 393 | bp->b_strat = xfs_bdstrat_cb; |
diff --git a/fs/xfs/linux-2.6/xfs_globals.c b/fs/xfs/linux-2.6/xfs_globals.c index 6c162c3dde7e..ed3a5e1b4b67 100644 --- a/fs/xfs/linux-2.6/xfs_globals.c +++ b/fs/xfs/linux-2.6/xfs_globals.c | |||
@@ -34,7 +34,7 @@ xfs_param_t xfs_params = { | |||
34 | .restrict_chown = { 0, 1, 1 }, | 34 | .restrict_chown = { 0, 1, 1 }, |
35 | .sgid_inherit = { 0, 0, 1 }, | 35 | .sgid_inherit = { 0, 0, 1 }, |
36 | .symlink_mode = { 0, 0, 1 }, | 36 | .symlink_mode = { 0, 0, 1 }, |
37 | .panic_mask = { 0, 0, 127 }, | 37 | .panic_mask = { 0, 0, 255 }, |
38 | .error_level = { 0, 3, 11 }, | 38 | .error_level = { 0, 3, 11 }, |
39 | .syncd_timer = { 1*100, 30*100, 7200*100}, | 39 | .syncd_timer = { 1*100, 30*100, 7200*100}, |
40 | .stats_clear = { 0, 0, 1 }, | 40 | .stats_clear = { 0, 0, 1 }, |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 6e52a5dd38d8..a74f854d91e6 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -653,7 +653,7 @@ xfs_attrmulti_by_handle( | |||
653 | STATIC int | 653 | STATIC int |
654 | xfs_ioc_space( | 654 | xfs_ioc_space( |
655 | bhv_desc_t *bdp, | 655 | bhv_desc_t *bdp, |
656 | bhv_vnode_t *vp, | 656 | struct inode *inode, |
657 | struct file *filp, | 657 | struct file *filp, |
658 | int flags, | 658 | int flags, |
659 | unsigned int cmd, | 659 | unsigned int cmd, |
@@ -735,7 +735,7 @@ xfs_ioctl( | |||
735 | !capable(CAP_SYS_ADMIN)) | 735 | !capable(CAP_SYS_ADMIN)) |
736 | return -EPERM; | 736 | return -EPERM; |
737 | 737 | ||
738 | return xfs_ioc_space(bdp, vp, filp, ioflags, cmd, arg); | 738 | return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg); |
739 | 739 | ||
740 | case XFS_IOC_DIOINFO: { | 740 | case XFS_IOC_DIOINFO: { |
741 | struct dioattr da; | 741 | struct dioattr da; |
@@ -763,6 +763,8 @@ xfs_ioctl( | |||
763 | return xfs_ioc_fsgeometry(mp, arg); | 763 | return xfs_ioc_fsgeometry(mp, arg); |
764 | 764 | ||
765 | case XFS_IOC_GETVERSION: | 765 | case XFS_IOC_GETVERSION: |
766 | return put_user(inode->i_generation, (int __user *)arg); | ||
767 | |||
766 | case XFS_IOC_GETXFLAGS: | 768 | case XFS_IOC_GETXFLAGS: |
767 | case XFS_IOC_SETXFLAGS: | 769 | case XFS_IOC_SETXFLAGS: |
768 | case XFS_IOC_FSGETXATTR: | 770 | case XFS_IOC_FSGETXATTR: |
@@ -957,7 +959,7 @@ xfs_ioctl( | |||
957 | STATIC int | 959 | STATIC int |
958 | xfs_ioc_space( | 960 | xfs_ioc_space( |
959 | bhv_desc_t *bdp, | 961 | bhv_desc_t *bdp, |
960 | bhv_vnode_t *vp, | 962 | struct inode *inode, |
961 | struct file *filp, | 963 | struct file *filp, |
962 | int ioflags, | 964 | int ioflags, |
963 | unsigned int cmd, | 965 | unsigned int cmd, |
@@ -967,13 +969,13 @@ xfs_ioc_space( | |||
967 | int attr_flags = 0; | 969 | int attr_flags = 0; |
968 | int error; | 970 | int error; |
969 | 971 | ||
970 | if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND)) | 972 | if (inode->i_flags & (S_IMMUTABLE|S_APPEND)) |
971 | return -XFS_ERROR(EPERM); | 973 | return -XFS_ERROR(EPERM); |
972 | 974 | ||
973 | if (!(filp->f_mode & FMODE_WRITE)) | 975 | if (!(filp->f_mode & FMODE_WRITE)) |
974 | return -XFS_ERROR(EBADF); | 976 | return -XFS_ERROR(EBADF); |
975 | 977 | ||
976 | if (!VN_ISREG(vp)) | 978 | if (!S_ISREG(inode->i_mode)) |
977 | return -XFS_ERROR(EINVAL); | 979 | return -XFS_ERROR(EINVAL); |
978 | 980 | ||
979 | if (copy_from_user(&bf, arg, sizeof(bf))) | 981 | if (copy_from_user(&bf, arg, sizeof(bf))) |
@@ -1264,13 +1266,6 @@ xfs_ioc_xattr( | |||
1264 | break; | 1266 | break; |
1265 | } | 1267 | } |
1266 | 1268 | ||
1267 | case XFS_IOC_GETVERSION: { | ||
1268 | flags = vn_to_inode(vp)->i_generation; | ||
1269 | if (copy_to_user(arg, &flags, sizeof(flags))) | ||
1270 | error = -EFAULT; | ||
1271 | break; | ||
1272 | } | ||
1273 | |||
1274 | default: | 1269 | default: |
1275 | error = -ENOTTY; | 1270 | error = -ENOTTY; |
1276 | break; | 1271 | break; |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 22e3b714f629..3ba814ae3bba 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -623,12 +623,27 @@ xfs_vn_getattr( | |||
623 | { | 623 | { |
624 | struct inode *inode = dentry->d_inode; | 624 | struct inode *inode = dentry->d_inode; |
625 | bhv_vnode_t *vp = vn_from_inode(inode); | 625 | bhv_vnode_t *vp = vn_from_inode(inode); |
626 | int error = 0; | 626 | bhv_vattr_t vattr = { .va_mask = XFS_AT_STAT }; |
627 | int error; | ||
627 | 628 | ||
628 | if (unlikely(vp->v_flag & VMODIFIED)) | 629 | error = bhv_vop_getattr(vp, &vattr, ATTR_LAZY, NULL); |
629 | error = vn_revalidate(vp); | 630 | if (likely(!error)) { |
630 | if (!error) | 631 | stat->size = i_size_read(inode); |
631 | generic_fillattr(inode, stat); | 632 | stat->dev = inode->i_sb->s_dev; |
633 | stat->rdev = (vattr.va_rdev == 0) ? 0 : | ||
634 | MKDEV(sysv_major(vattr.va_rdev) & 0x1ff, | ||
635 | sysv_minor(vattr.va_rdev)); | ||
636 | stat->mode = vattr.va_mode; | ||
637 | stat->nlink = vattr.va_nlink; | ||
638 | stat->uid = vattr.va_uid; | ||
639 | stat->gid = vattr.va_gid; | ||
640 | stat->ino = vattr.va_nodeid; | ||
641 | stat->atime = vattr.va_atime; | ||
642 | stat->mtime = vattr.va_mtime; | ||
643 | stat->ctime = vattr.va_ctime; | ||
644 | stat->blocks = vattr.va_nblocks; | ||
645 | stat->blksize = vattr.va_blocksize; | ||
646 | } | ||
632 | return -error; | 647 | return -error; |
633 | } | 648 | } |
634 | 649 | ||
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index a13f75c1a936..2b0e0018738a 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
@@ -148,11 +148,7 @@ BUFFER_FNS(PrivateStart, unwritten); | |||
148 | (current->flags = ((current->flags & ~(f)) | (*(sp) & (f)))) | 148 | (current->flags = ((current->flags & ~(f)) | (*(sp) & (f)))) |
149 | 149 | ||
150 | #define NBPP PAGE_SIZE | 150 | #define NBPP PAGE_SIZE |
151 | #define DPPSHFT (PAGE_SHIFT - 9) | ||
152 | #define NDPP (1 << (PAGE_SHIFT - 9)) | 151 | #define NDPP (1 << (PAGE_SHIFT - 9)) |
153 | #define dtop(DD) (((DD) + NDPP - 1) >> DPPSHFT) | ||
154 | #define dtopt(DD) ((DD) >> DPPSHFT) | ||
155 | #define dpoff(DD) ((DD) & (NDPP-1)) | ||
156 | 152 | ||
157 | #define NBBY 8 /* number of bits per byte */ | 153 | #define NBBY 8 /* number of bits per byte */ |
158 | #define NBPC PAGE_SIZE /* Number of bytes per click */ | 154 | #define NBPC PAGE_SIZE /* Number of bytes per click */ |
@@ -172,8 +168,6 @@ BUFFER_FNS(PrivateStart, unwritten); | |||
172 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) | 168 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) |
173 | #define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) | 169 | #define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) |
174 | #define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) | 170 | #define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) |
175 | #define io_btoc(x) (((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT) | ||
176 | #define io_btoct(x) ((__psunsigned_t)(x)>>IO_BPCSHIFT) | ||
177 | 171 | ||
178 | /* off_t bytes to clicks */ | 172 | /* off_t bytes to clicks */ |
179 | #define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) | 173 | #define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) |
@@ -186,7 +180,6 @@ BUFFER_FNS(PrivateStart, unwritten); | |||
186 | #define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) | 180 | #define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) |
187 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) | 181 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) |
188 | #define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) | 182 | #define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) |
189 | #define io_ctob(x) ((__psunsigned_t)(x)<<IO_BPCSHIFT) | ||
190 | 183 | ||
191 | /* bytes to clicks */ | 184 | /* bytes to clicks */ |
192 | #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) | 185 | #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) |
@@ -339,4 +332,11 @@ static inline __uint64_t roundup_64(__uint64_t x, __uint32_t y) | |||
339 | return(x * y); | 332 | return(x * y); |
340 | } | 333 | } |
341 | 334 | ||
335 | static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y) | ||
336 | { | ||
337 | x += y - 1; | ||
338 | do_div(x, y); | ||
339 | return x; | ||
340 | } | ||
341 | |||
342 | #endif /* __XFS_LINUX__ */ | 342 | #endif /* __XFS_LINUX__ */ |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index ee788b1cb364..55992b40353c 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -270,12 +270,12 @@ xfs_read( | |||
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | if (unlikely((ioflags & IO_ISDIRECT) && VN_CACHED(vp))) | 273 | if (unlikely(ioflags & IO_ISDIRECT)) { |
274 | bhv_vop_flushinval_pages(vp, ctooff(offtoct(*offset)), | 274 | if (VN_CACHED(vp)) |
275 | -1, FI_REMAPF_LOCKED); | 275 | bhv_vop_flushinval_pages(vp, ctooff(offtoct(*offset)), |
276 | 276 | -1, FI_REMAPF_LOCKED); | |
277 | if (unlikely(ioflags & IO_ISDIRECT)) | ||
278 | mutex_unlock(&inode->i_mutex); | 277 | mutex_unlock(&inode->i_mutex); |
278 | } | ||
279 | 279 | ||
280 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, | 280 | xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, |
281 | (void *)iovp, segs, *offset, ioflags); | 281 | (void *)iovp, segs, *offset, ioflags); |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 9df9ed37d219..38c4d128a8c0 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -227,7 +227,9 @@ xfs_initialize_vnode( | |||
227 | xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip); | 227 | xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip); |
228 | xfs_set_inodeops(inode); | 228 | xfs_set_inodeops(inode); |
229 | 229 | ||
230 | spin_lock(&ip->i_flags_lock); | ||
230 | ip->i_flags &= ~XFS_INEW; | 231 | ip->i_flags &= ~XFS_INEW; |
232 | spin_unlock(&ip->i_flags_lock); | ||
231 | barrier(); | 233 | barrier(); |
232 | 234 | ||
233 | unlock_new_inode(inode); | 235 | unlock_new_inode(inode); |
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h index 91fc2c4b3353..da255bdf5260 100644 --- a/fs/xfs/linux-2.6/xfs_vfs.h +++ b/fs/xfs/linux-2.6/xfs_vfs.h | |||
@@ -79,7 +79,7 @@ typedef enum { | |||
79 | #define VFS_RDONLY 0x0001 /* read-only vfs */ | 79 | #define VFS_RDONLY 0x0001 /* read-only vfs */ |
80 | #define VFS_GRPID 0x0002 /* group-ID assigned from directory */ | 80 | #define VFS_GRPID 0x0002 /* group-ID assigned from directory */ |
81 | #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ | 81 | #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ |
82 | #define VFS_UMOUNT 0x0008 /* unmount in progress */ | 82 | /* ---- VFS_UMOUNT ---- 0x0008 -- unneeded, fixed via kthread APIs */ |
83 | #define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */ | 83 | #define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */ |
84 | #define VFS_END 0x0010 /* max flag */ | 84 | #define VFS_END 0x0010 /* max flag */ |
85 | 85 | ||
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index c42b3221b20c..515f5fdea57a 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -85,8 +85,6 @@ typedef enum { | |||
85 | #define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh))) | 85 | #define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh))) |
86 | #define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name) | 86 | #define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name) |
87 | #define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp) | 87 | #define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp) |
88 | #define vn_bhv_lookup(bhp,ops) bhv_lookup(bhp,ops) | ||
89 | #define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops) | ||
90 | 88 | ||
91 | /* | 89 | /* |
92 | * Vnode to Linux inode mapping. | 90 | * Vnode to Linux inode mapping. |