aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/mrlock.h6
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c142
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h4
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c51
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c12
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.h6
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h10
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c48
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c33
-rw-r--r--fs/xfs/linux-2.6/xfs_sysctl.c266
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h4
17 files changed, 345 insertions, 267 deletions
diff --git a/fs/xfs/linux-2.6/mrlock.h b/fs/xfs/linux-2.6/mrlock.h
index 32e1ce0f04c9..af168a1a98c1 100644
--- a/fs/xfs/linux-2.6/mrlock.h
+++ b/fs/xfs/linux-2.6/mrlock.h
@@ -31,15 +31,13 @@ typedef struct {
31 do { (mrp)->mr_writer = 0; init_rwsem(&(mrp)->mr_lock); } while (0) 31 do { (mrp)->mr_writer = 0; init_rwsem(&(mrp)->mr_lock); } while (0)
32#define mrlock_init(mrp, t,n,s) mrinit(mrp, n) 32#define mrlock_init(mrp, t,n,s) mrinit(mrp, n)
33#define mrfree(mrp) do { } while (0) 33#define mrfree(mrp) do { } while (0)
34#define mraccess(mrp) mraccessf(mrp, 0)
35#define mrupdate(mrp) mrupdatef(mrp, 0)
36 34
37static inline void mraccessf(mrlock_t *mrp, int flags) 35static inline void mraccess(mrlock_t *mrp)
38{ 36{
39 down_read(&mrp->mr_lock); 37 down_read(&mrp->mr_lock);
40} 38}
41 39
42static inline void mrupdatef(mrlock_t *mrp, int flags) 40static inline void mrupdate(mrlock_t *mrp)
43{ 41{
44 down_write(&mrp->mr_lock); 42 down_write(&mrp->mr_lock);
45 mrp->mr_writer = 1; 43 mrp->mr_writer = 1;
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 7b54461695e2..143ffc851c9d 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -56,8 +56,6 @@ xfs_count_page_state(
56 do { 56 do {
57 if (buffer_uptodate(bh) && !buffer_mapped(bh)) 57 if (buffer_uptodate(bh) && !buffer_mapped(bh))
58 (*unmapped) = 1; 58 (*unmapped) = 1;
59 else if (buffer_unwritten(bh) && !buffer_delay(bh))
60 clear_buffer_unwritten(bh);
61 else if (buffer_unwritten(bh)) 59 else if (buffer_unwritten(bh))
62 (*unwritten) = 1; 60 (*unwritten) = 1;
63 else if (buffer_delay(bh)) 61 else if (buffer_delay(bh))
@@ -249,7 +247,7 @@ xfs_map_blocks(
249 return -error; 247 return -error;
250} 248}
251 249
252STATIC inline int 250STATIC_INLINE int
253xfs_iomap_valid( 251xfs_iomap_valid(
254 xfs_iomap_t *iomapp, 252 xfs_iomap_t *iomapp,
255 loff_t offset) 253 loff_t offset)
@@ -1272,7 +1270,6 @@ __xfs_get_blocks(
1272 if (direct) 1270 if (direct)
1273 bh_result->b_private = inode; 1271 bh_result->b_private = inode;
1274 set_buffer_unwritten(bh_result); 1272 set_buffer_unwritten(bh_result);
1275 set_buffer_delay(bh_result);
1276 } 1273 }
1277 } 1274 }
1278 1275
@@ -1283,13 +1280,18 @@ __xfs_get_blocks(
1283 bh_result->b_bdev = iomap.iomap_target->bt_bdev; 1280 bh_result->b_bdev = iomap.iomap_target->bt_bdev;
1284 1281
1285 /* 1282 /*
1286 * If we previously allocated a block out beyond eof and we are 1283 * If we previously allocated a block out beyond eof and we are now
1287 * now coming back to use it then we will need to flag it as new 1284 * coming back to use it then we will need to flag it as new even if it
1288 * even if it has a disk address. 1285 * has a disk address.
1286 *
1287 * With sub-block writes into unwritten extents we also need to mark
1288 * the buffer as new so that the unwritten parts of the buffer gets
1289 * correctly zeroed.
1289 */ 1290 */
1290 if (create && 1291 if (create &&
1291 ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) || 1292 ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
1292 (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW))) 1293 (offset >= i_size_read(inode)) ||
1294 (iomap.iomap_flags & (IOMAP_NEW|IOMAP_UNWRITTEN))))
1293 set_buffer_new(bh_result); 1295 set_buffer_new(bh_result);
1294 1296
1295 if (iomap.iomap_flags & IOMAP_DELAY) { 1297 if (iomap.iomap_flags & IOMAP_DELAY) {
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 4fb01ffdfd1a..e2bea6a661f0 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -34,13 +34,13 @@
34#include <linux/backing-dev.h> 34#include <linux/backing-dev.h>
35#include <linux/freezer.h> 35#include <linux/freezer.h>
36 36
37STATIC kmem_zone_t *xfs_buf_zone; 37static kmem_zone_t *xfs_buf_zone;
38STATIC kmem_shaker_t xfs_buf_shake; 38static kmem_shaker_t xfs_buf_shake;
39STATIC int xfsbufd(void *); 39STATIC int xfsbufd(void *);
40STATIC int xfsbufd_wakeup(int, gfp_t); 40STATIC int xfsbufd_wakeup(int, gfp_t);
41STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int); 41STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int);
42 42
43STATIC struct workqueue_struct *xfslogd_workqueue; 43static struct workqueue_struct *xfslogd_workqueue;
44struct workqueue_struct *xfsdatad_workqueue; 44struct workqueue_struct *xfsdatad_workqueue;
45 45
46#ifdef XFS_BUF_TRACE 46#ifdef XFS_BUF_TRACE
@@ -139,7 +139,7 @@ page_region_mask(
139 return mask; 139 return mask;
140} 140}
141 141
142STATIC inline void 142STATIC_INLINE void
143set_page_region( 143set_page_region(
144 struct page *page, 144 struct page *page,
145 size_t offset, 145 size_t offset,
@@ -151,7 +151,7 @@ set_page_region(
151 SetPageUptodate(page); 151 SetPageUptodate(page);
152} 152}
153 153
154STATIC inline int 154STATIC_INLINE int
155test_page_region( 155test_page_region(
156 struct page *page, 156 struct page *page,
157 size_t offset, 157 size_t offset,
@@ -171,9 +171,9 @@ typedef struct a_list {
171 struct a_list *next; 171 struct a_list *next;
172} a_list_t; 172} a_list_t;
173 173
174STATIC a_list_t *as_free_head; 174static a_list_t *as_free_head;
175STATIC int as_list_len; 175static int as_list_len;
176STATIC DEFINE_SPINLOCK(as_lock); 176static DEFINE_SPINLOCK(as_lock);
177 177
178/* 178/*
179 * Try to batch vunmaps because they are costly. 179 * Try to batch vunmaps because they are costly.
@@ -1085,7 +1085,7 @@ xfs_buf_iostart(
1085 return status; 1085 return status;
1086} 1086}
1087 1087
1088STATIC __inline__ int 1088STATIC_INLINE int
1089_xfs_buf_iolocked( 1089_xfs_buf_iolocked(
1090 xfs_buf_t *bp) 1090 xfs_buf_t *bp)
1091{ 1091{
@@ -1095,7 +1095,7 @@ _xfs_buf_iolocked(
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098STATIC __inline__ void 1098STATIC_INLINE void
1099_xfs_buf_ioend( 1099_xfs_buf_ioend(
1100 xfs_buf_t *bp, 1100 xfs_buf_t *bp,
1101 int schedule) 1101 int schedule)
@@ -1426,8 +1426,8 @@ xfs_free_bufhash(
1426/* 1426/*
1427 * buftarg list for delwrite queue processing 1427 * buftarg list for delwrite queue processing
1428 */ 1428 */
1429STATIC LIST_HEAD(xfs_buftarg_list); 1429LIST_HEAD(xfs_buftarg_list);
1430STATIC DEFINE_SPINLOCK(xfs_buftarg_lock); 1430static DEFINE_SPINLOCK(xfs_buftarg_lock);
1431 1431
1432STATIC void 1432STATIC void
1433xfs_register_buftarg( 1433xfs_register_buftarg(
@@ -1679,21 +1679,60 @@ xfsbufd_wakeup(
1679 return 0; 1679 return 0;
1680} 1680}
1681 1681
1682/*
1683 * Move as many buffers as specified to the supplied list
1684 * idicating if we skipped any buffers to prevent deadlocks.
1685 */
1686STATIC int
1687xfs_buf_delwri_split(
1688 xfs_buftarg_t *target,
1689 struct list_head *list,
1690 unsigned long age)
1691{
1692 xfs_buf_t *bp, *n;
1693 struct list_head *dwq = &target->bt_delwrite_queue;
1694 spinlock_t *dwlk = &target->bt_delwrite_lock;
1695 int skipped = 0;
1696 int force;
1697
1698 force = test_and_clear_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1699 INIT_LIST_HEAD(list);
1700 spin_lock(dwlk);
1701 list_for_each_entry_safe(bp, n, dwq, b_list) {
1702 XB_TRACE(bp, "walkq1", (long)xfs_buf_ispin(bp));
1703 ASSERT(bp->b_flags & XBF_DELWRI);
1704
1705 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) {
1706 if (!force &&
1707 time_before(jiffies, bp->b_queuetime + age)) {
1708 xfs_buf_unlock(bp);
1709 break;
1710 }
1711
1712 bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q|
1713 _XBF_RUN_QUEUES);
1714 bp->b_flags |= XBF_WRITE;
1715 list_move_tail(&bp->b_list, list);
1716 } else
1717 skipped++;
1718 }
1719 spin_unlock(dwlk);
1720
1721 return skipped;
1722
1723}
1724
1682STATIC int 1725STATIC int
1683xfsbufd( 1726xfsbufd(
1684 void *data) 1727 void *data)
1685{ 1728{
1686 struct list_head tmp; 1729 struct list_head tmp;
1687 unsigned long age; 1730 xfs_buftarg_t *target = (xfs_buftarg_t *)data;
1688 xfs_buftarg_t *target = (xfs_buftarg_t *)data; 1731 int count;
1689 xfs_buf_t *bp, *n; 1732 xfs_buf_t *bp;
1690 struct list_head *dwq = &target->bt_delwrite_queue;
1691 spinlock_t *dwlk = &target->bt_delwrite_lock;
1692 int count;
1693 1733
1694 current->flags |= PF_MEMALLOC; 1734 current->flags |= PF_MEMALLOC;
1695 1735
1696 INIT_LIST_HEAD(&tmp);
1697 do { 1736 do {
1698 if (unlikely(freezing(current))) { 1737 if (unlikely(freezing(current))) {
1699 set_bit(XBT_FORCE_SLEEP, &target->bt_flags); 1738 set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
@@ -1705,37 +1744,17 @@ xfsbufd(
1705 schedule_timeout_interruptible( 1744 schedule_timeout_interruptible(
1706 xfs_buf_timer_centisecs * msecs_to_jiffies(10)); 1745 xfs_buf_timer_centisecs * msecs_to_jiffies(10));
1707 1746
1708 count = 0; 1747 xfs_buf_delwri_split(target, &tmp,
1709 age = xfs_buf_age_centisecs * msecs_to_jiffies(10); 1748 xfs_buf_age_centisecs * msecs_to_jiffies(10));
1710 spin_lock(dwlk);
1711 list_for_each_entry_safe(bp, n, dwq, b_list) {
1712 XB_TRACE(bp, "walkq1", (long)xfs_buf_ispin(bp));
1713 ASSERT(bp->b_flags & XBF_DELWRI);
1714
1715 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) {
1716 if (!test_bit(XBT_FORCE_FLUSH,
1717 &target->bt_flags) &&
1718 time_before(jiffies,
1719 bp->b_queuetime + age)) {
1720 xfs_buf_unlock(bp);
1721 break;
1722 }
1723
1724 bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q|
1725 _XBF_RUN_QUEUES);
1726 bp->b_flags |= XBF_WRITE;
1727 list_move_tail(&bp->b_list, &tmp);
1728 count++;
1729 }
1730 }
1731 spin_unlock(dwlk);
1732 1749
1750 count = 0;
1733 while (!list_empty(&tmp)) { 1751 while (!list_empty(&tmp)) {
1734 bp = list_entry(tmp.next, xfs_buf_t, b_list); 1752 bp = list_entry(tmp.next, xfs_buf_t, b_list);
1735 ASSERT(target == bp->b_target); 1753 ASSERT(target == bp->b_target);
1736 1754
1737 list_del_init(&bp->b_list); 1755 list_del_init(&bp->b_list);
1738 xfs_buf_iostrategy(bp); 1756 xfs_buf_iostrategy(bp);
1757 count++;
1739 } 1758 }
1740 1759
1741 if (as_list_len > 0) 1760 if (as_list_len > 0)
@@ -1743,7 +1762,6 @@ xfsbufd(
1743 if (count) 1762 if (count)
1744 blk_run_address_space(target->bt_mapping); 1763 blk_run_address_space(target->bt_mapping);
1745 1764
1746 clear_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1747 } while (!kthread_should_stop()); 1765 } while (!kthread_should_stop());
1748 1766
1749 return 0; 1767 return 0;
@@ -1756,40 +1774,24 @@ xfsbufd(
1756 */ 1774 */
1757int 1775int
1758xfs_flush_buftarg( 1776xfs_flush_buftarg(
1759 xfs_buftarg_t *target, 1777 xfs_buftarg_t *target,
1760 int wait) 1778 int wait)
1761{ 1779{
1762 struct list_head tmp; 1780 struct list_head tmp;
1763 xfs_buf_t *bp, *n; 1781 xfs_buf_t *bp, *n;
1764 int pincount = 0; 1782 int pincount = 0;
1765 struct list_head *dwq = &target->bt_delwrite_queue;
1766 spinlock_t *dwlk = &target->bt_delwrite_lock;
1767 1783
1768 xfs_buf_runall_queues(xfsdatad_workqueue); 1784 xfs_buf_runall_queues(xfsdatad_workqueue);
1769 xfs_buf_runall_queues(xfslogd_workqueue); 1785 xfs_buf_runall_queues(xfslogd_workqueue);
1770 1786
1771 INIT_LIST_HEAD(&tmp); 1787 set_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1772 spin_lock(dwlk); 1788 pincount = xfs_buf_delwri_split(target, &tmp, 0);
1773 list_for_each_entry_safe(bp, n, dwq, b_list) {
1774 ASSERT(bp->b_target == target);
1775 ASSERT(bp->b_flags & (XBF_DELWRI | _XBF_DELWRI_Q));
1776 XB_TRACE(bp, "walkq2", (long)xfs_buf_ispin(bp));
1777 if (xfs_buf_ispin(bp)) {
1778 pincount++;
1779 continue;
1780 }
1781
1782 list_move_tail(&bp->b_list, &tmp);
1783 }
1784 spin_unlock(dwlk);
1785 1789
1786 /* 1790 /*
1787 * Dropped the delayed write list lock, now walk the temporary list 1791 * Dropped the delayed write list lock, now walk the temporary list
1788 */ 1792 */
1789 list_for_each_entry_safe(bp, n, &tmp, b_list) { 1793 list_for_each_entry_safe(bp, n, &tmp, b_list) {
1790 xfs_buf_lock(bp); 1794 ASSERT(target == bp->b_target);
1791 bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q|_XBF_RUN_QUEUES);
1792 bp->b_flags |= XBF_WRITE;
1793 if (wait) 1795 if (wait)
1794 bp->b_flags &= ~XBF_ASYNC; 1796 bp->b_flags &= ~XBF_ASYNC;
1795 else 1797 else
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 9dd235cb0107..9e8ef8fef39f 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -69,8 +69,8 @@ typedef enum {
69} xfs_buf_flags_t; 69} xfs_buf_flags_t;
70 70
71typedef enum { 71typedef enum {
72 XBT_FORCE_SLEEP = (0 << 1), 72 XBT_FORCE_SLEEP = 0,
73 XBT_FORCE_FLUSH = (1 << 1), 73 XBT_FORCE_FLUSH = 1,
74} xfs_buftarg_flags_t; 74} xfs_buftarg_flags_t;
75 75
76typedef struct xfs_bufhash { 76typedef struct xfs_bufhash {
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 5fb75d9151f2..e3a5fedac1ba 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -24,7 +24,7 @@
24#include "xfs_mount.h" 24#include "xfs_mount.h"
25#include "xfs_export.h" 25#include "xfs_export.h"
26 26
27STATIC struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; 27static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, };
28 28
29/* 29/*
30 * XFS encodes and decodes the fileid portion of NFS filehandles 30 * XFS encodes and decodes the fileid portion of NFS filehandles
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index d26f5cd2ba70..cb51dc961355 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -46,7 +46,7 @@ static struct vm_operations_struct xfs_file_vm_ops;
46static struct vm_operations_struct xfs_dmapi_file_vm_ops; 46static struct vm_operations_struct xfs_dmapi_file_vm_ops;
47#endif 47#endif
48 48
49STATIC inline ssize_t 49STATIC_INLINE ssize_t
50__xfs_file_read( 50__xfs_file_read(
51 struct kiocb *iocb, 51 struct kiocb *iocb,
52 const struct iovec *iov, 52 const struct iovec *iov,
@@ -84,7 +84,7 @@ xfs_file_aio_read_invis(
84 return __xfs_file_read(iocb, iov, nr_segs, IO_ISAIO|IO_INVIS, pos); 84 return __xfs_file_read(iocb, iov, nr_segs, IO_ISAIO|IO_INVIS, pos);
85} 85}
86 86
87STATIC inline ssize_t 87STATIC_INLINE ssize_t
88__xfs_file_write( 88__xfs_file_write(
89 struct kiocb *iocb, 89 struct kiocb *iocb,
90 const struct iovec *iov, 90 const struct iovec *iov,
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index f011c9cd0d62..ff5c41ff8d40 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -41,8 +41,6 @@
41#include "xfs_error.h" 41#include "xfs_error.h"
42#include "xfs_rw.h" 42#include "xfs_rw.h"
43#include "xfs_acl.h" 43#include "xfs_acl.h"
44#include "xfs_cap.h"
45#include "xfs_mac.h"
46#include "xfs_attr.h" 44#include "xfs_attr.h"
47#include "xfs_bmap.h" 45#include "xfs_bmap.h"
48#include "xfs_buf_item.h" 46#include "xfs_buf_item.h"
@@ -355,7 +353,6 @@ STATIC int
355xfs_readlink_by_handle( 353xfs_readlink_by_handle(
356 xfs_mount_t *mp, 354 xfs_mount_t *mp,
357 void __user *arg, 355 void __user *arg,
358 struct file *parfilp,
359 struct inode *parinode) 356 struct inode *parinode)
360{ 357{
361 int error; 358 int error;
@@ -388,7 +385,7 @@ xfs_readlink_by_handle(
388 aiov.iov_len = olen; 385 aiov.iov_len = olen;
389 aiov.iov_base = hreq.ohandle; 386 aiov.iov_base = hreq.ohandle;
390 387
391 auio.uio_iov = &aiov; 388 auio.uio_iov = (struct kvec *)&aiov;
392 auio.uio_iovcnt = 1; 389 auio.uio_iovcnt = 1;
393 auio.uio_offset = 0; 390 auio.uio_offset = 0;
394 auio.uio_segflg = UIO_USERSPACE; 391 auio.uio_segflg = UIO_USERSPACE;
@@ -406,7 +403,6 @@ STATIC int
406xfs_fssetdm_by_handle( 403xfs_fssetdm_by_handle(
407 xfs_mount_t *mp, 404 xfs_mount_t *mp,
408 void __user *arg, 405 void __user *arg,
409 struct file *parfilp,
410 struct inode *parinode) 406 struct inode *parinode)
411{ 407{
412 int error; 408 int error;
@@ -448,7 +444,6 @@ STATIC int
448xfs_attrlist_by_handle( 444xfs_attrlist_by_handle(
449 xfs_mount_t *mp, 445 xfs_mount_t *mp,
450 void __user *arg, 446 void __user *arg,
451 struct file *parfilp,
452 struct inode *parinode) 447 struct inode *parinode)
453{ 448{
454 int error; 449 int error;
@@ -569,7 +564,6 @@ STATIC int
569xfs_attrmulti_by_handle( 564xfs_attrmulti_by_handle(
570 xfs_mount_t *mp, 565 xfs_mount_t *mp,
571 void __user *arg, 566 void __user *arg,
572 struct file *parfilp,
573 struct inode *parinode) 567 struct inode *parinode)
574{ 568{
575 int error; 569 int error;
@@ -689,7 +683,6 @@ xfs_ioc_xattr(
689STATIC int 683STATIC int
690xfs_ioc_getbmap( 684xfs_ioc_getbmap(
691 bhv_desc_t *bdp, 685 bhv_desc_t *bdp,
692 struct file *filp,
693 int flags, 686 int flags,
694 unsigned int cmd, 687 unsigned int cmd,
695 void __user *arg); 688 void __user *arg);
@@ -788,7 +781,7 @@ xfs_ioctl(
788 781
789 case XFS_IOC_GETBMAP: 782 case XFS_IOC_GETBMAP:
790 case XFS_IOC_GETBMAPA: 783 case XFS_IOC_GETBMAPA:
791 return xfs_ioc_getbmap(bdp, filp, ioflags, cmd, arg); 784 return xfs_ioc_getbmap(bdp, ioflags, cmd, arg);
792 785
793 case XFS_IOC_GETBMAPX: 786 case XFS_IOC_GETBMAPX:
794 return xfs_ioc_getbmapx(bdp, arg); 787 return xfs_ioc_getbmapx(bdp, arg);
@@ -802,16 +795,16 @@ xfs_ioctl(
802 return xfs_open_by_handle(mp, arg, filp, inode); 795 return xfs_open_by_handle(mp, arg, filp, inode);
803 796
804 case XFS_IOC_FSSETDM_BY_HANDLE: 797 case XFS_IOC_FSSETDM_BY_HANDLE:
805 return xfs_fssetdm_by_handle(mp, arg, filp, inode); 798 return xfs_fssetdm_by_handle(mp, arg, inode);
806 799
807 case XFS_IOC_READLINK_BY_HANDLE: 800 case XFS_IOC_READLINK_BY_HANDLE:
808 return xfs_readlink_by_handle(mp, arg, filp, inode); 801 return xfs_readlink_by_handle(mp, arg, inode);
809 802
810 case XFS_IOC_ATTRLIST_BY_HANDLE: 803 case XFS_IOC_ATTRLIST_BY_HANDLE:
811 return xfs_attrlist_by_handle(mp, arg, filp, inode); 804 return xfs_attrlist_by_handle(mp, arg, inode);
812 805
813 case XFS_IOC_ATTRMULTI_BY_HANDLE: 806 case XFS_IOC_ATTRMULTI_BY_HANDLE:
814 return xfs_attrmulti_by_handle(mp, arg, filp, inode); 807 return xfs_attrmulti_by_handle(mp, arg, inode);
815 808
816 case XFS_IOC_SWAPEXT: { 809 case XFS_IOC_SWAPEXT: {
817 error = xfs_swapext((struct xfs_swapext __user *)arg); 810 error = xfs_swapext((struct xfs_swapext __user *)arg);
@@ -1095,11 +1088,6 @@ xfs_ioc_fsgeometry(
1095/* 1088/*
1096 * Linux extended inode flags interface. 1089 * Linux extended inode flags interface.
1097 */ 1090 */
1098#define LINUX_XFLAG_SYNC 0x00000008 /* Synchronous updates */
1099#define LINUX_XFLAG_IMMUTABLE 0x00000010 /* Immutable file */
1100#define LINUX_XFLAG_APPEND 0x00000020 /* writes to file may only append */
1101#define LINUX_XFLAG_NODUMP 0x00000040 /* do not dump file */
1102#define LINUX_XFLAG_NOATIME 0x00000080 /* do not update atime */
1103 1091
1104STATIC unsigned int 1092STATIC unsigned int
1105xfs_merge_ioc_xflags( 1093xfs_merge_ioc_xflags(
@@ -1108,23 +1096,23 @@ xfs_merge_ioc_xflags(
1108{ 1096{
1109 unsigned int xflags = start; 1097 unsigned int xflags = start;
1110 1098
1111 if (flags & LINUX_XFLAG_IMMUTABLE) 1099 if (flags & FS_IMMUTABLE_FL)
1112 xflags |= XFS_XFLAG_IMMUTABLE; 1100 xflags |= XFS_XFLAG_IMMUTABLE;
1113 else 1101 else
1114 xflags &= ~XFS_XFLAG_IMMUTABLE; 1102 xflags &= ~XFS_XFLAG_IMMUTABLE;
1115 if (flags & LINUX_XFLAG_APPEND) 1103 if (flags & FS_APPEND_FL)
1116 xflags |= XFS_XFLAG_APPEND; 1104 xflags |= XFS_XFLAG_APPEND;
1117 else 1105 else
1118 xflags &= ~XFS_XFLAG_APPEND; 1106 xflags &= ~XFS_XFLAG_APPEND;
1119 if (flags & LINUX_XFLAG_SYNC) 1107 if (flags & FS_SYNC_FL)
1120 xflags |= XFS_XFLAG_SYNC; 1108 xflags |= XFS_XFLAG_SYNC;
1121 else 1109 else
1122 xflags &= ~XFS_XFLAG_SYNC; 1110 xflags &= ~XFS_XFLAG_SYNC;
1123 if (flags & LINUX_XFLAG_NOATIME) 1111 if (flags & FS_NOATIME_FL)
1124 xflags |= XFS_XFLAG_NOATIME; 1112 xflags |= XFS_XFLAG_NOATIME;
1125 else 1113 else
1126 xflags &= ~XFS_XFLAG_NOATIME; 1114 xflags &= ~XFS_XFLAG_NOATIME;
1127 if (flags & LINUX_XFLAG_NODUMP) 1115 if (flags & FS_NODUMP_FL)
1128 xflags |= XFS_XFLAG_NODUMP; 1116 xflags |= XFS_XFLAG_NODUMP;
1129 else 1117 else
1130 xflags &= ~XFS_XFLAG_NODUMP; 1118 xflags &= ~XFS_XFLAG_NODUMP;
@@ -1139,15 +1127,15 @@ xfs_di2lxflags(
1139 unsigned int flags = 0; 1127 unsigned int flags = 0;
1140 1128
1141 if (di_flags & XFS_DIFLAG_IMMUTABLE) 1129 if (di_flags & XFS_DIFLAG_IMMUTABLE)
1142 flags |= LINUX_XFLAG_IMMUTABLE; 1130 flags |= FS_IMMUTABLE_FL;
1143 if (di_flags & XFS_DIFLAG_APPEND) 1131 if (di_flags & XFS_DIFLAG_APPEND)
1144 flags |= LINUX_XFLAG_APPEND; 1132 flags |= FS_APPEND_FL;
1145 if (di_flags & XFS_DIFLAG_SYNC) 1133 if (di_flags & XFS_DIFLAG_SYNC)
1146 flags |= LINUX_XFLAG_SYNC; 1134 flags |= FS_SYNC_FL;
1147 if (di_flags & XFS_DIFLAG_NOATIME) 1135 if (di_flags & XFS_DIFLAG_NOATIME)
1148 flags |= LINUX_XFLAG_NOATIME; 1136 flags |= FS_NOATIME_FL;
1149 if (di_flags & XFS_DIFLAG_NODUMP) 1137 if (di_flags & XFS_DIFLAG_NODUMP)
1150 flags |= LINUX_XFLAG_NODUMP; 1138 flags |= FS_NODUMP_FL;
1151 return flags; 1139 return flags;
1152} 1140}
1153 1141
@@ -1247,9 +1235,9 @@ xfs_ioc_xattr(
1247 break; 1235 break;
1248 } 1236 }
1249 1237
1250 if (flags & ~(LINUX_XFLAG_IMMUTABLE | LINUX_XFLAG_APPEND | \ 1238 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
1251 LINUX_XFLAG_NOATIME | LINUX_XFLAG_NODUMP | \ 1239 FS_NOATIME_FL | FS_NODUMP_FL | \
1252 LINUX_XFLAG_SYNC)) { 1240 FS_SYNC_FL)) {
1253 error = -EOPNOTSUPP; 1241 error = -EOPNOTSUPP;
1254 break; 1242 break;
1255 } 1243 }
@@ -1281,7 +1269,6 @@ xfs_ioc_xattr(
1281STATIC int 1269STATIC int
1282xfs_ioc_getbmap( 1270xfs_ioc_getbmap(
1283 bhv_desc_t *bdp, 1271 bhv_desc_t *bdp,
1284 struct file *filp,
1285 int ioflags, 1272 int ioflags,
1286 unsigned int cmd, 1273 unsigned int cmd,
1287 void __user *arg) 1274 void __user *arg)
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 3ba814ae3bba..0b5fa124bef2 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -43,8 +43,6 @@
43#include "xfs_itable.h" 43#include "xfs_itable.h"
44#include "xfs_rw.h" 44#include "xfs_rw.h"
45#include "xfs_acl.h" 45#include "xfs_acl.h"
46#include "xfs_cap.h"
47#include "xfs_mac.h"
48#include "xfs_attr.h" 46#include "xfs_attr.h"
49#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
50#include "xfs_utils.h" 48#include "xfs_utils.h"
@@ -250,13 +248,13 @@ xfs_init_security(
250 * 248 *
251 * XXX(hch): nfsd is broken, better fix it instead. 249 * XXX(hch): nfsd is broken, better fix it instead.
252 */ 250 */
253STATIC inline int 251STATIC_INLINE int
254xfs_has_fs_struct(struct task_struct *task) 252xfs_has_fs_struct(struct task_struct *task)
255{ 253{
256 return (task->fs != init_task.fs); 254 return (task->fs != init_task.fs);
257} 255}
258 256
259STATIC inline void 257STATIC void
260xfs_cleanup_inode( 258xfs_cleanup_inode(
261 bhv_vnode_t *dvp, 259 bhv_vnode_t *dvp,
262 bhv_vnode_t *vp, 260 bhv_vnode_t *vp,
@@ -815,7 +813,7 @@ xfs_vn_removexattr(
815} 813}
816 814
817 815
818struct inode_operations xfs_inode_operations = { 816const struct inode_operations xfs_inode_operations = {
819 .permission = xfs_vn_permission, 817 .permission = xfs_vn_permission,
820 .truncate = xfs_vn_truncate, 818 .truncate = xfs_vn_truncate,
821 .getattr = xfs_vn_getattr, 819 .getattr = xfs_vn_getattr,
@@ -826,7 +824,7 @@ struct inode_operations xfs_inode_operations = {
826 .removexattr = xfs_vn_removexattr, 824 .removexattr = xfs_vn_removexattr,
827}; 825};
828 826
829struct inode_operations xfs_dir_inode_operations = { 827const struct inode_operations xfs_dir_inode_operations = {
830 .create = xfs_vn_create, 828 .create = xfs_vn_create,
831 .lookup = xfs_vn_lookup, 829 .lookup = xfs_vn_lookup,
832 .link = xfs_vn_link, 830 .link = xfs_vn_link,
@@ -845,7 +843,7 @@ struct inode_operations xfs_dir_inode_operations = {
845 .removexattr = xfs_vn_removexattr, 843 .removexattr = xfs_vn_removexattr,
846}; 844};
847 845
848struct inode_operations xfs_symlink_inode_operations = { 846const struct inode_operations xfs_symlink_inode_operations = {
849 .readlink = generic_readlink, 847 .readlink = generic_readlink,
850 .follow_link = xfs_vn_follow_link, 848 .follow_link = xfs_vn_follow_link,
851 .put_link = xfs_vn_put_link, 849 .put_link = xfs_vn_put_link,
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h
index ad6173da5678..95a69398fce0 100644
--- a/fs/xfs/linux-2.6/xfs_iops.h
+++ b/fs/xfs/linux-2.6/xfs_iops.h
@@ -18,9 +18,9 @@
18#ifndef __XFS_IOPS_H__ 18#ifndef __XFS_IOPS_H__
19#define __XFS_IOPS_H__ 19#define __XFS_IOPS_H__
20 20
21extern struct inode_operations xfs_inode_operations; 21extern const struct inode_operations xfs_inode_operations;
22extern struct inode_operations xfs_dir_inode_operations; 22extern const struct inode_operations xfs_dir_inode_operations;
23extern struct inode_operations xfs_symlink_inode_operations; 23extern const struct inode_operations xfs_symlink_inode_operations;
24 24
25extern const struct file_operations xfs_file_operations; 25extern const struct file_operations xfs_file_operations;
26extern const struct file_operations xfs_dir_file_operations; 26extern const struct file_operations xfs_dir_file_operations;
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 2b0e0018738a..715adad7dd4d 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -109,16 +109,6 @@
109#undef HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */ 109#undef HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
110#endif 110#endif
111 111
112/*
113 * State flag for unwritten extent buffers.
114 *
115 * We need to be able to distinguish between these and delayed
116 * allocate buffers within XFS. The generic IO path code does
117 * not need to distinguish - we use the BH_Delay flag for both
118 * delalloc and these ondisk-uninitialised buffers.
119 */
120BUFFER_FNS(PrivateStart, unwritten);
121
122#define restricted_chown xfs_params.restrict_chown.val 112#define restricted_chown xfs_params.restrict_chown.val
123#define irix_sgid_inherit xfs_params.sgid_inherit.val 113#define irix_sgid_inherit xfs_params.sgid_inherit.val
124#define irix_symlink_mode xfs_params.symlink_mode.val 114#define irix_symlink_mode xfs_params.symlink_mode.val
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index 65e79b471d49..ff8d64eba9f8 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -43,8 +43,6 @@
43#include "xfs_itable.h" 43#include "xfs_itable.h"
44#include "xfs_rw.h" 44#include "xfs_rw.h"
45#include "xfs_acl.h" 45#include "xfs_acl.h"
46#include "xfs_cap.h"
47#include "xfs_mac.h"
48#include "xfs_attr.h" 46#include "xfs_attr.h"
49#include "xfs_inode_item.h" 47#include "xfs_inode_item.h"
50#include "xfs_buf_item.h" 48#include "xfs_buf_item.h"
@@ -134,13 +132,11 @@ STATIC int
134xfs_iozero( 132xfs_iozero(
135 struct inode *ip, /* inode */ 133 struct inode *ip, /* inode */
136 loff_t pos, /* offset in file */ 134 loff_t pos, /* offset in file */
137 size_t count, /* size of data to zero */ 135 size_t count) /* size of data to zero */
138 loff_t end_size) /* max file size to set */
139{ 136{
140 unsigned bytes; 137 unsigned bytes;
141 struct page *page; 138 struct page *page;
142 struct address_space *mapping; 139 struct address_space *mapping;
143 char *kaddr;
144 int status; 140 int status;
145 141
146 mapping = ip->i_mapping; 142 mapping = ip->i_mapping;
@@ -158,26 +154,21 @@ xfs_iozero(
158 if (!page) 154 if (!page)
159 break; 155 break;
160 156
161 kaddr = kmap(page);
162 status = mapping->a_ops->prepare_write(NULL, page, offset, 157 status = mapping->a_ops->prepare_write(NULL, page, offset,
163 offset + bytes); 158 offset + bytes);
164 if (status) { 159 if (status)
165 goto unlock; 160 goto unlock;
166 }
167 161
168 memset((void *) (kaddr + offset), 0, bytes); 162 memclear_highpage_flush(page, offset, bytes);
169 flush_dcache_page(page); 163
170 status = mapping->a_ops->commit_write(NULL, page, offset, 164 status = mapping->a_ops->commit_write(NULL, page, offset,
171 offset + bytes); 165 offset + bytes);
172 if (!status) { 166 if (!status) {
173 pos += bytes; 167 pos += bytes;
174 count -= bytes; 168 count -= bytes;
175 if (pos > i_size_read(ip))
176 i_size_write(ip, pos < end_size ? pos : end_size);
177 } 169 }
178 170
179unlock: 171unlock:
180 kunmap(page);
181 unlock_page(page); 172 unlock_page(page);
182 page_cache_release(page); 173 page_cache_release(page);
183 if (status) 174 if (status)
@@ -449,8 +440,8 @@ STATIC int /* error (positive) */
449xfs_zero_last_block( 440xfs_zero_last_block(
450 struct inode *ip, 441 struct inode *ip,
451 xfs_iocore_t *io, 442 xfs_iocore_t *io,
452 xfs_fsize_t isize, 443 xfs_fsize_t offset,
453 xfs_fsize_t end_size) 444 xfs_fsize_t isize)
454{ 445{
455 xfs_fileoff_t last_fsb; 446 xfs_fileoff_t last_fsb;
456 xfs_mount_t *mp = io->io_mount; 447 xfs_mount_t *mp = io->io_mount;
@@ -459,7 +450,6 @@ xfs_zero_last_block(
459 int zero_len; 450 int zero_len;
460 int error = 0; 451 int error = 0;
461 xfs_bmbt_irec_t imap; 452 xfs_bmbt_irec_t imap;
462 loff_t loff;
463 453
464 ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0); 454 ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0);
465 455
@@ -494,9 +484,10 @@ xfs_zero_last_block(
494 */ 484 */
495 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); 485 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
496 486
497 loff = XFS_FSB_TO_B(mp, last_fsb);
498 zero_len = mp->m_sb.sb_blocksize - zero_offset; 487 zero_len = mp->m_sb.sb_blocksize - zero_offset;
499 error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size); 488 if (isize + zero_len > offset)
489 zero_len = offset - isize;
490 error = xfs_iozero(ip, isize, zero_len);
500 491
501 XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); 492 XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
502 ASSERT(error >= 0); 493 ASSERT(error >= 0);
@@ -519,14 +510,15 @@ xfs_zero_eof(
519 bhv_vnode_t *vp, 510 bhv_vnode_t *vp,
520 xfs_iocore_t *io, 511 xfs_iocore_t *io,
521 xfs_off_t offset, /* starting I/O offset */ 512 xfs_off_t offset, /* starting I/O offset */
522 xfs_fsize_t isize, /* current inode size */ 513 xfs_fsize_t isize) /* current inode size */
523 xfs_fsize_t end_size) /* terminal inode size */
524{ 514{
525 struct inode *ip = vn_to_inode(vp); 515 struct inode *ip = vn_to_inode(vp);
526 xfs_fileoff_t start_zero_fsb; 516 xfs_fileoff_t start_zero_fsb;
527 xfs_fileoff_t end_zero_fsb; 517 xfs_fileoff_t end_zero_fsb;
528 xfs_fileoff_t zero_count_fsb; 518 xfs_fileoff_t zero_count_fsb;
529 xfs_fileoff_t last_fsb; 519 xfs_fileoff_t last_fsb;
520 xfs_fileoff_t zero_off;
521 xfs_fsize_t zero_len;
530 xfs_mount_t *mp = io->io_mount; 522 xfs_mount_t *mp = io->io_mount;
531 int nimaps; 523 int nimaps;
532 int error = 0; 524 int error = 0;
@@ -540,7 +532,7 @@ xfs_zero_eof(
540 * First handle zeroing the block on which isize resides. 532 * First handle zeroing the block on which isize resides.
541 * We only zero a part of that block so it is handled specially. 533 * We only zero a part of that block so it is handled specially.
542 */ 534 */
543 error = xfs_zero_last_block(ip, io, isize, end_size); 535 error = xfs_zero_last_block(ip, io, offset, isize);
544 if (error) { 536 if (error) {
545 ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); 537 ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
546 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); 538 ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
@@ -601,10 +593,13 @@ xfs_zero_eof(
601 */ 593 */
602 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); 594 XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
603 595
604 error = xfs_iozero(ip, 596 zero_off = XFS_FSB_TO_B(mp, start_zero_fsb);
605 XFS_FSB_TO_B(mp, start_zero_fsb), 597 zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount);
606 XFS_FSB_TO_B(mp, imap.br_blockcount), 598
607 end_size); 599 if ((zero_off + zero_len) > offset)
600 zero_len = offset - zero_off;
601
602 error = xfs_iozero(ip, zero_off, zero_len);
608 if (error) { 603 if (error) {
609 goto out_lock; 604 goto out_lock;
610 } 605 }
@@ -783,8 +778,7 @@ start:
783 */ 778 */
784 779
785 if (pos > isize) { 780 if (pos > isize) {
786 error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, 781 error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, pos, isize);
787 isize, pos + count);
788 if (error) { 782 if (error) {
789 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock); 783 xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
790 goto out_unlock_mutex; 784 goto out_unlock_mutex;
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
index c77e62efb742..7ac51b1d2161 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.h
+++ b/fs/xfs/linux-2.6/xfs_lrw.h
@@ -83,7 +83,7 @@ extern int xfs_bdstrat_cb(struct xfs_buf *);
83extern int xfs_dev_is_read_only(struct xfs_mount *, char *); 83extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
84 84
85extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t, 85extern int xfs_zero_eof(struct bhv_vnode *, struct xfs_iocore *, xfs_off_t,
86 xfs_fsize_t, xfs_fsize_t); 86 xfs_fsize_t);
87extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *, 87extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
88 const struct iovec *, unsigned int, 88 const struct iovec *, unsigned int,
89 loff_t *, int, struct cred *); 89 loff_t *, int, struct cred *);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index b93265b7c79c..1a4103ca593c 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -43,8 +43,6 @@
43#include "xfs_itable.h" 43#include "xfs_itable.h"
44#include "xfs_rw.h" 44#include "xfs_rw.h"
45#include "xfs_acl.h" 45#include "xfs_acl.h"
46#include "xfs_cap.h"
47#include "xfs_mac.h"
48#include "xfs_attr.h" 46#include "xfs_attr.h"
49#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
50#include "xfs_utils.h" 48#include "xfs_utils.h"
@@ -58,10 +56,10 @@
58#include <linux/kthread.h> 56#include <linux/kthread.h>
59#include <linux/freezer.h> 57#include <linux/freezer.h>
60 58
61STATIC struct quotactl_ops xfs_quotactl_operations; 59static struct quotactl_ops xfs_quotactl_operations;
62STATIC struct super_operations xfs_super_operations; 60static struct super_operations xfs_super_operations;
63STATIC kmem_zone_t *xfs_vnode_zone; 61static kmem_zone_t *xfs_vnode_zone;
64STATIC kmem_zone_t *xfs_ioend_zone; 62static kmem_zone_t *xfs_ioend_zone;
65mempool_t *xfs_ioend_pool; 63mempool_t *xfs_ioend_pool;
66 64
67STATIC struct xfs_mount_args * 65STATIC struct xfs_mount_args *
@@ -121,7 +119,7 @@ xfs_max_file_offset(
121 return (((__uint64_t)pagefactor) << bitshift) - 1; 119 return (((__uint64_t)pagefactor) << bitshift) - 1;
122} 120}
123 121
124STATIC __inline__ void 122STATIC_INLINE void
125xfs_set_inodeops( 123xfs_set_inodeops(
126 struct inode *inode) 124 struct inode *inode)
127{ 125{
@@ -147,7 +145,7 @@ xfs_set_inodeops(
147 } 145 }
148} 146}
149 147
150STATIC __inline__ void 148STATIC_INLINE void
151xfs_revalidate_inode( 149xfs_revalidate_inode(
152 xfs_mount_t *mp, 150 xfs_mount_t *mp,
153 bhv_vnode_t *vp, 151 bhv_vnode_t *vp,
@@ -553,7 +551,6 @@ vfs_sync_worker(
553 error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \ 551 error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \
554 SYNC_ATTR | SYNC_REFCACHE, NULL); 552 SYNC_ATTR | SYNC_REFCACHE, NULL);
555 vfsp->vfs_sync_seq++; 553 vfsp->vfs_sync_seq++;
556 wmb();
557 wake_up(&vfsp->vfs_wait_single_sync_task); 554 wake_up(&vfsp->vfs_wait_single_sync_task);
558} 555}
559 556
@@ -659,9 +656,17 @@ xfs_fs_sync_super(
659 int error; 656 int error;
660 int flags; 657 int flags;
661 658
662 if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) 659 if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
663 flags = SYNC_QUIESCE; 660 /*
664 else 661 * First stage of freeze - no more writers will make progress
662 * now we are here, so we flush delwri and delalloc buffers
663 * here, then wait for all I/O to complete. Data is frozen at
664 * that point. Metadata is not frozen, transactions can still
665 * occur here so don't bother flushing the buftarg (i.e
666 * SYNC_QUIESCE) because it'll just get dirty again.
667 */
668 flags = SYNC_FSDATA | SYNC_DELWRI | SYNC_WAIT | SYNC_IOWAIT;
669 } else
665 flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); 670 flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
666 671
667 error = bhv_vfs_sync(vfsp, flags, NULL); 672 error = bhv_vfs_sync(vfsp, flags, NULL);
@@ -873,7 +878,7 @@ xfs_fs_get_sb(
873 mnt); 878 mnt);
874} 879}
875 880
876STATIC struct super_operations xfs_super_operations = { 881static struct super_operations xfs_super_operations = {
877 .alloc_inode = xfs_fs_alloc_inode, 882 .alloc_inode = xfs_fs_alloc_inode,
878 .destroy_inode = xfs_fs_destroy_inode, 883 .destroy_inode = xfs_fs_destroy_inode,
879 .write_inode = xfs_fs_write_inode, 884 .write_inode = xfs_fs_write_inode,
@@ -887,7 +892,7 @@ STATIC struct super_operations xfs_super_operations = {
887 .show_options = xfs_fs_show_options, 892 .show_options = xfs_fs_show_options,
888}; 893};
889 894
890STATIC struct quotactl_ops xfs_quotactl_operations = { 895static struct quotactl_ops xfs_quotactl_operations = {
891 .quota_sync = xfs_fs_quotasync, 896 .quota_sync = xfs_fs_quotasync,
892 .get_xstate = xfs_fs_getxstate, 897 .get_xstate = xfs_fs_getxstate,
893 .set_xstate = xfs_fs_setxstate, 898 .set_xstate = xfs_fs_setxstate,
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
index af246532fbfb..5c46c35a97a5 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.c
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -54,102 +54,204 @@ xfs_stats_clear_proc_handler(
54} 54}
55#endif /* CONFIG_PROC_FS */ 55#endif /* CONFIG_PROC_FS */
56 56
57STATIC ctl_table xfs_table[] = { 57static ctl_table xfs_table[] = {
58 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val, 58 {
59 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 59 .ctl_name = XFS_RESTRICT_CHOWN,
60 &sysctl_intvec, NULL, 60 .procname = "restrict_chown",
61 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max}, 61 .data = &xfs_params.restrict_chown.val,
62 62 .maxlen = sizeof(int),
63 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val, 63 .mode = 0644,
64 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 64 .proc_handler = &proc_dointvec_minmax,
65 &sysctl_intvec, NULL, 65 .strategy = &sysctl_intvec,
66 &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max}, 66 .extra1 = &xfs_params.restrict_chown.min,
67 67 .extra2 = &xfs_params.restrict_chown.max
68 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val, 68 },
69 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 69 {
70 &sysctl_intvec, NULL, 70 .ctl_name = XFS_SGID_INHERIT,
71 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max}, 71 .procname = "irix_sgid_inherit",
72 72 .data = &xfs_params.sgid_inherit.val,
73 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val, 73 .maxlen = sizeof(int),
74 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 74 .mode = 0644,
75 &sysctl_intvec, NULL, 75 .proc_handler = &proc_dointvec_minmax,
76 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max}, 76 .strategy = &sysctl_intvec,
77 77 .extra1 = &xfs_params.sgid_inherit.min,
78 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val, 78 .extra2 = &xfs_params.sgid_inherit.max
79 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 79 },
80 &sysctl_intvec, NULL, 80 {
81 &xfs_params.error_level.min, &xfs_params.error_level.max}, 81 .ctl_name = XFS_SYMLINK_MODE,
82 82 .procname = "irix_symlink_mode",
83 {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val, 83 .data = &xfs_params.symlink_mode.val,
84 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 84 .maxlen = sizeof(int),
85 &sysctl_intvec, NULL, 85 .mode = 0644,
86 &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max}, 86 .proc_handler = &proc_dointvec_minmax,
87 87 .strategy = &sysctl_intvec,
88 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val, 88 .extra1 = &xfs_params.symlink_mode.min,
89 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 89 .extra2 = &xfs_params.symlink_mode.max
90 &sysctl_intvec, NULL, 90 },
91 &xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max}, 91 {
92 92 .ctl_name = XFS_PANIC_MASK,
93 {XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val, 93 .procname = "panic_mask",
94 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 94 .data = &xfs_params.panic_mask.val,
95 &sysctl_intvec, NULL, 95 .maxlen = sizeof(int),
96 &xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max}, 96 .mode = 0644,
97 97 .proc_handler = &proc_dointvec_minmax,
98 {XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val, 98 .strategy = &sysctl_intvec,
99 sizeof(int), 0644, NULL, &proc_dointvec_minmax, 99 .extra1 = &xfs_params.panic_mask.min,
100 &sysctl_intvec, NULL, 100 .extra2 = &xfs_params.panic_mask.max
101 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max}, 101 },
102
103 {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
104 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
105 &sysctl_intvec, NULL,
106 &xfs_params.xfs_buf_timer.min, &xfs_params.xfs_buf_timer.max},
107
108 {XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
109 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
110 &sysctl_intvec, NULL,
111 &xfs_params.xfs_buf_age.min, &xfs_params.xfs_buf_age.max},
112
113 {XFS_INHERIT_NOSYM, "inherit_nosymlinks", &xfs_params.inherit_nosym.val,
114 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
115 &sysctl_intvec, NULL,
116 &xfs_params.inherit_nosym.min, &xfs_params.inherit_nosym.max},
117
118 {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
119 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
120 &sysctl_intvec, NULL,
121 &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
122
123 {XFS_INHERIT_NODFRG, "inherit_nodefrag", &xfs_params.inherit_nodfrg.val,
124 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
125 &sysctl_intvec, NULL,
126 &xfs_params.inherit_nodfrg.min, &xfs_params.inherit_nodfrg.max},
127 102
103 {
104 .ctl_name = XFS_ERRLEVEL,
105 .procname = "error_level",
106 .data = &xfs_params.error_level.val,
107 .maxlen = sizeof(int),
108 .mode = 0644,
109 .proc_handler = &proc_dointvec_minmax,
110 .strategy = &sysctl_intvec,
111 .extra1 = &xfs_params.error_level.min,
112 .extra2 = &xfs_params.error_level.max
113 },
114 {
115 .ctl_name = XFS_SYNCD_TIMER,
116 .procname = "xfssyncd_centisecs",
117 .data = &xfs_params.syncd_timer.val,
118 .maxlen = sizeof(int),
119 .mode = 0644,
120 .proc_handler = &proc_dointvec_minmax,
121 .strategy = &sysctl_intvec,
122 .extra1 = &xfs_params.syncd_timer.min,
123 .extra2 = &xfs_params.syncd_timer.max
124 },
125 {
126 .ctl_name = XFS_INHERIT_SYNC,
127 .procname = "inherit_sync",
128 .data = &xfs_params.inherit_sync.val,
129 .maxlen = sizeof(int),
130 .mode = 0644,
131 .proc_handler = &proc_dointvec_minmax,
132 .strategy = &sysctl_intvec,
133 .extra1 = &xfs_params.inherit_sync.min,
134 .extra2 = &xfs_params.inherit_sync.max
135 },
136 {
137 .ctl_name = XFS_INHERIT_NODUMP,
138 .procname = "inherit_nodump",
139 .data = &xfs_params.inherit_nodump.val,
140 .maxlen = sizeof(int),
141 .mode = 0644,
142 .proc_handler = &proc_dointvec_minmax,
143 .strategy = &sysctl_intvec,
144 .extra1 = &xfs_params.inherit_nodump.min,
145 .extra2 = &xfs_params.inherit_nodump.max
146 },
147 {
148 .ctl_name = XFS_INHERIT_NOATIME,
149 .procname = "inherit_noatime",
150 .data = &xfs_params.inherit_noatim.val,
151 .maxlen = sizeof(int),
152 .mode = 0644,
153 .proc_handler = &proc_dointvec_minmax,
154 .strategy = &sysctl_intvec,
155 .extra1 = &xfs_params.inherit_noatim.min,
156 .extra2 = &xfs_params.inherit_noatim.max
157 },
158 {
159 .ctl_name = XFS_BUF_TIMER,
160 .procname = "xfsbufd_centisecs",
161 .data = &xfs_params.xfs_buf_timer.val,
162 .maxlen = sizeof(int),
163 .mode = 0644,
164 .proc_handler = &proc_dointvec_minmax,
165 .strategy = &sysctl_intvec,
166 .extra1 = &xfs_params.xfs_buf_timer.min,
167 .extra2 = &xfs_params.xfs_buf_timer.max
168 },
169 {
170 .ctl_name = XFS_BUF_AGE,
171 .procname = "age_buffer_centisecs",
172 .data = &xfs_params.xfs_buf_age.val,
173 .maxlen = sizeof(int),
174 .mode = 0644,
175 .proc_handler = &proc_dointvec_minmax,
176 .strategy = &sysctl_intvec,
177 .extra1 = &xfs_params.xfs_buf_age.min,
178 .extra2 = &xfs_params.xfs_buf_age.max
179 },
180 {
181 .ctl_name = XFS_INHERIT_NOSYM,
182 .procname = "inherit_nosymlinks",
183 .data = &xfs_params.inherit_nosym.val,
184 .maxlen = sizeof(int),
185 .mode = 0644,
186 .proc_handler = &proc_dointvec_minmax,
187 .strategy = &sysctl_intvec,
188 .extra1 = &xfs_params.inherit_nosym.min,
189 .extra2 = &xfs_params.inherit_nosym.max
190 },
191 {
192 .ctl_name = XFS_ROTORSTEP,
193 .procname = "rotorstep",
194 .data = &xfs_params.rotorstep.val,
195 .maxlen = sizeof(int),
196 .mode = 0644,
197 .proc_handler = &proc_dointvec_minmax,
198 .strategy = &sysctl_intvec,
199 .extra1 = &xfs_params.rotorstep.min,
200 .extra2 = &xfs_params.rotorstep.max
201 },
202 {
203 .ctl_name = XFS_INHERIT_NODFRG,
204 .procname = "inherit_nodefrag",
205 .data = &xfs_params.inherit_nodfrg.val,
206 .maxlen = sizeof(int),
207 .mode = 0644,
208 .proc_handler = &proc_dointvec_minmax,
209 .strategy = &sysctl_intvec,
210 .extra1 = &xfs_params.inherit_nodfrg.min,
211 .extra2 = &xfs_params.inherit_nodfrg.max
212 },
128 /* please keep this the last entry */ 213 /* please keep this the last entry */
129#ifdef CONFIG_PROC_FS 214#ifdef CONFIG_PROC_FS
130 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val, 215 {
131 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler, 216 .ctl_name = XFS_STATS_CLEAR,
132 &sysctl_intvec, NULL, 217 .procname = "stats_clear",
133 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max}, 218 .data = &xfs_params.stats_clear.val,
219 .maxlen = sizeof(int),
220 .mode = 0644,
221 .proc_handler = &xfs_stats_clear_proc_handler,
222 .strategy = &sysctl_intvec,
223 .extra1 = &xfs_params.stats_clear.min,
224 .extra2 = &xfs_params.stats_clear.max
225 },
134#endif /* CONFIG_PROC_FS */ 226#endif /* CONFIG_PROC_FS */
135 227
136 {0} 228 {}
137}; 229};
138 230
139STATIC ctl_table xfs_dir_table[] = { 231static ctl_table xfs_dir_table[] = {
140 {FS_XFS, "xfs", NULL, 0, 0555, xfs_table}, 232 {
141 {0} 233 .ctl_name = FS_XFS,
234 .procname = "xfs",
235 .mode = 0555,
236 .child = xfs_table
237 },
238 {}
142}; 239};
143 240
144STATIC ctl_table xfs_root_table[] = { 241static ctl_table xfs_root_table[] = {
145 {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table}, 242 {
146 {0} 243 .ctl_name = CTL_FS,
244 .procname = "fs",
245 .mode = 0555,
246 .child = xfs_dir_table
247 },
248 {}
147}; 249};
148 250
149void 251void
150xfs_sysctl_register(void) 252xfs_sysctl_register(void)
151{ 253{
152 xfs_table_header = register_sysctl_table(xfs_root_table, 1); 254 xfs_table_header = register_sysctl_table(xfs_root_table, 0);
153} 255}
154 256
155void 257void
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h
index da255bdf5260..e2c2ce98ab5b 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.h
+++ b/fs/xfs/linux-2.6/xfs_vfs.h
@@ -91,7 +91,7 @@ typedef enum {
91#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ 91#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
92#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ 92#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
93#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ 93#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
94#define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */ 94#define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */
95 95
96#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */ 96#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
97#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */ 97#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 553fa731ade5..ada24baf88de 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -26,7 +26,7 @@ DEFINE_SPINLOCK(vnumber_lock);
26 */ 26 */
27#define NVSYNC 37 27#define NVSYNC 37
28#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) 28#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC])
29STATIC wait_queue_head_t vsync[NVSYNC]; 29static wait_queue_head_t vsync[NVSYNC];
30 30
31void 31void
32vn_init(void) 32vn_init(void)
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 515f5fdea57a..b76118cf4897 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -489,14 +489,14 @@ static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp)
489#define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) 489#define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock)
490#define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) 490#define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s)
491 491
492static __inline__ void vn_flagset(struct bhv_vnode *vp, uint flag) 492STATIC_INLINE void vn_flagset(struct bhv_vnode *vp, uint flag)
493{ 493{
494 spin_lock(&vp->v_lock); 494 spin_lock(&vp->v_lock);
495 vp->v_flag |= flag; 495 vp->v_flag |= flag;
496 spin_unlock(&vp->v_lock); 496 spin_unlock(&vp->v_lock);
497} 497}
498 498
499static __inline__ uint vn_flagclr(struct bhv_vnode *vp, uint flag) 499STATIC_INLINE uint vn_flagclr(struct bhv_vnode *vp, uint flag)
500{ 500{
501 uint cleared; 501 uint cleared;
502 502