aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2016-03-06 17:30:12 -0500
committerDave Chinner <david@fromorbit.com>2016-03-06 17:30:12 -0500
commit6d247d47fbd6883f7096e0e672afbdba6286dbc4 (patch)
treeef576302d9f0075bf77725132dd886f00443beec
parentacb3e26fc3652d43cb5cf07c311ed55f3aecf40e (diff)
parentaf055e37a91d215d7174d0b84c86795ca81086a7 (diff)
Merge branch 'xfs-misc-fixes-4.6' into for-next
-rw-r--r--fs/xfs/libxfs/xfs_alloc_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_attr_sf.h16
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_btree.c32
-rw-r--r--fs/xfs/libxfs/xfs_da_format.h16
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c12
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c1
-rw-r--r--fs/xfs/libxfs/xfs_sb.h1
-rw-r--r--fs/xfs/xfs_aops.c23
-rw-r--r--fs/xfs/xfs_fsops.h1
-rw-r--r--fs/xfs/xfs_mount.h1
-rw-r--r--fs/xfs/xfs_trans_ail.c5
12 files changed, 62 insertions, 49 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
index 444626ddbd1b..d9b42425291e 100644
--- a/fs/xfs/libxfs/xfs_alloc_btree.c
+++ b/fs/xfs/libxfs/xfs_alloc_btree.c
@@ -118,8 +118,6 @@ xfs_allocbt_free_block(
118 xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1, 118 xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1,
119 XFS_EXTENT_BUSY_SKIP_DISCARD); 119 XFS_EXTENT_BUSY_SKIP_DISCARD);
120 xfs_trans_agbtree_delta(cur->bc_tp, -1); 120 xfs_trans_agbtree_delta(cur->bc_tp, -1);
121
122 xfs_trans_binval(cur->bc_tp, bp);
123 return 0; 121 return 0;
124} 122}
125 123
diff --git a/fs/xfs/libxfs/xfs_attr_sf.h b/fs/xfs/libxfs/xfs_attr_sf.h
index 919756e3ba53..90928bbe693c 100644
--- a/fs/xfs/libxfs/xfs_attr_sf.h
+++ b/fs/xfs/libxfs/xfs_attr_sf.h
@@ -24,22 +24,6 @@
24 * Small attribute lists are packed as tightly as possible so as 24 * Small attribute lists are packed as tightly as possible so as
25 * to fit into the literal area of the inode. 25 * to fit into the literal area of the inode.
26 */ 26 */
27
28/*
29 * Entries are packed toward the top as tight as possible.
30 */
31typedef struct xfs_attr_shortform {
32 struct xfs_attr_sf_hdr { /* constant-structure header block */
33 __be16 totsize; /* total bytes in shortform list */
34 __u8 count; /* count of active entries */
35 } hdr;
36 struct xfs_attr_sf_entry {
37 __uint8_t namelen; /* actual length of name (no NULL) */
38 __uint8_t valuelen; /* actual length of value (no NULL) */
39 __uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
40 __uint8_t nameval[1]; /* name & value bytes concatenated */
41 } list[1]; /* variable sized array */
42} xfs_attr_shortform_t;
43typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t; 27typedef struct xfs_attr_sf_hdr xfs_attr_sf_hdr_t;
44typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t; 28typedef struct xfs_attr_sf_entry xfs_attr_sf_entry_t;
45 29
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index 1637c37bfbaa..e37508ae589b 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -531,7 +531,6 @@ xfs_bmbt_free_block(
531 531
532 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 532 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
533 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); 533 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);
534 xfs_trans_binval(tp, bp);
535 return 0; 534 return 0;
536} 535}
537 536
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index a0eb18ce3ad3..1f88e1ce770f 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -294,6 +294,21 @@ xfs_btree_sblock_verify_crc(
294 return true; 294 return true;
295} 295}
296 296
297static int
298xfs_btree_free_block(
299 struct xfs_btree_cur *cur,
300 struct xfs_buf *bp)
301{
302 int error;
303
304 error = cur->bc_ops->free_block(cur, bp);
305 if (!error) {
306 xfs_trans_binval(cur->bc_tp, bp);
307 XFS_BTREE_STATS_INC(cur, free);
308 }
309 return error;
310}
311
297/* 312/*
298 * Delete the btree cursor. 313 * Delete the btree cursor.
299 */ 314 */
@@ -3209,6 +3224,7 @@ xfs_btree_kill_iroot(
3209 int level; 3224 int level;
3210 int index; 3225 int index;
3211 int numrecs; 3226 int numrecs;
3227 int error;
3212#ifdef DEBUG 3228#ifdef DEBUG
3213 union xfs_btree_ptr ptr; 3229 union xfs_btree_ptr ptr;
3214 int i; 3230 int i;
@@ -3272,8 +3288,6 @@ xfs_btree_kill_iroot(
3272 cpp = xfs_btree_ptr_addr(cur, 1, cblock); 3288 cpp = xfs_btree_ptr_addr(cur, 1, cblock);
3273#ifdef DEBUG 3289#ifdef DEBUG
3274 for (i = 0; i < numrecs; i++) { 3290 for (i = 0; i < numrecs; i++) {
3275 int error;
3276
3277 error = xfs_btree_check_ptr(cur, cpp, i, level - 1); 3291 error = xfs_btree_check_ptr(cur, cpp, i, level - 1);
3278 if (error) { 3292 if (error) {
3279 XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR); 3293 XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
@@ -3283,8 +3297,11 @@ xfs_btree_kill_iroot(
3283#endif 3297#endif
3284 xfs_btree_copy_ptrs(cur, pp, cpp, numrecs); 3298 xfs_btree_copy_ptrs(cur, pp, cpp, numrecs);
3285 3299
3286 cur->bc_ops->free_block(cur, cbp); 3300 error = xfs_btree_free_block(cur, cbp);
3287 XFS_BTREE_STATS_INC(cur, free); 3301 if (error) {
3302 XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
3303 return error;
3304 }
3288 3305
3289 cur->bc_bufs[level - 1] = NULL; 3306 cur->bc_bufs[level - 1] = NULL;
3290 be16_add_cpu(&block->bb_level, -1); 3307 be16_add_cpu(&block->bb_level, -1);
@@ -3317,14 +3334,12 @@ xfs_btree_kill_root(
3317 */ 3334 */
3318 cur->bc_ops->set_root(cur, newroot, -1); 3335 cur->bc_ops->set_root(cur, newroot, -1);
3319 3336
3320 error = cur->bc_ops->free_block(cur, bp); 3337 error = xfs_btree_free_block(cur, bp);
3321 if (error) { 3338 if (error) {
3322 XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR); 3339 XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
3323 return error; 3340 return error;
3324 } 3341 }
3325 3342
3326 XFS_BTREE_STATS_INC(cur, free);
3327
3328 cur->bc_bufs[level] = NULL; 3343 cur->bc_bufs[level] = NULL;
3329 cur->bc_ra[level] = 0; 3344 cur->bc_ra[level] = 0;
3330 cur->bc_nlevels--; 3345 cur->bc_nlevels--;
@@ -3830,10 +3845,9 @@ xfs_btree_delrec(
3830 } 3845 }
3831 3846
3832 /* Free the deleted block. */ 3847 /* Free the deleted block. */
3833 error = cur->bc_ops->free_block(cur, rbp); 3848 error = xfs_btree_free_block(cur, rbp);
3834 if (error) 3849 if (error)
3835 goto error0; 3850 goto error0;
3836 XFS_BTREE_STATS_INC(cur, free);
3837 3851
3838 /* 3852 /*
3839 * If we joined with the left neighbor, set the buffer in the 3853 * If we joined with the left neighbor, set the buffer in the
diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index b14bbd6bb05f..8d4d8bce41bf 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -641,6 +641,22 @@ xfs_dir2_block_leaf_p(struct xfs_dir2_block_tail *btp)
641 */ 641 */
642#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */ 642#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */
643 643
644/*
645 * Entries are packed toward the top as tight as possible.
646 */
647typedef struct xfs_attr_shortform {
648 struct xfs_attr_sf_hdr { /* constant-structure header block */
649 __be16 totsize; /* total bytes in shortform list */
650 __u8 count; /* count of active entries */
651 } hdr;
652 struct xfs_attr_sf_entry {
653 __uint8_t namelen; /* actual length of name (no NULL) */
654 __uint8_t valuelen; /* actual length of value (no NULL) */
655 __uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
656 __uint8_t nameval[1]; /* name & value bytes concatenated */
657 } list[1]; /* variable sized array */
658} xfs_attr_shortform_t;
659
644typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */ 660typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */
645 __be16 base; /* base of free region */ 661 __be16 base; /* base of free region */
646 __be16 size; /* length of free region */ 662 __be16 size; /* length of free region */
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index c679f3c05b63..89c21d771e35 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -125,16 +125,8 @@ xfs_inobt_free_block(
125 struct xfs_btree_cur *cur, 125 struct xfs_btree_cur *cur,
126 struct xfs_buf *bp) 126 struct xfs_buf *bp)
127{ 127{
128 xfs_fsblock_t fsbno; 128 return xfs_free_extent(cur->bc_tp,
129 int error; 129 XFS_DADDR_TO_FSB(cur->bc_mp, XFS_BUF_ADDR(bp)), 1);
130
131 fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, XFS_BUF_ADDR(bp));
132 error = xfs_free_extent(cur->bc_tp, fsbno, 1);
133 if (error)
134 return error;
135
136 xfs_trans_binval(cur->bc_tp, bp);
137 return error;
138} 130}
139 131
140STATIC int 132STATIC int
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 0defbd02f62d..ef22a78fb569 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -31,6 +31,7 @@
31#include "xfs_error.h" 31#include "xfs_error.h"
32#include "xfs_trace.h" 32#include "xfs_trace.h"
33#include "xfs_attr_sf.h" 33#include "xfs_attr_sf.h"
34#include "xfs_da_format.h"
34 35
35kmem_zone_t *xfs_ifork_zone; 36kmem_zone_t *xfs_ifork_zone;
36 37
diff --git a/fs/xfs/libxfs/xfs_sb.h b/fs/xfs/libxfs/xfs_sb.h
index b25bb9a343f3..961e6475a309 100644
--- a/fs/xfs/libxfs/xfs_sb.h
+++ b/fs/xfs/libxfs/xfs_sb.h
@@ -27,7 +27,6 @@ extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber_t,
27extern void xfs_perag_put(struct xfs_perag *pag); 27extern void xfs_perag_put(struct xfs_perag *pag);
28extern int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t); 28extern int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t);
29 29
30extern void xfs_sb_calc_crc(struct xfs_buf *bp);
31extern void xfs_log_sb(struct xfs_trans *tp); 30extern void xfs_log_sb(struct xfs_trans *tp);
32extern int xfs_sync_sb(struct xfs_mount *mp, bool wait); 31extern int xfs_sync_sb(struct xfs_mount *mp, bool wait);
33extern void xfs_sb_mount_common(struct xfs_mount *mp, struct xfs_sb *sbp); 32extern void xfs_sb_mount_common(struct xfs_mount *mp, struct xfs_sb *sbp);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 8163910bc49f..14ac9822b303 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -218,10 +218,12 @@ xfs_end_io(
218 struct xfs_inode *ip = XFS_I(ioend->io_inode); 218 struct xfs_inode *ip = XFS_I(ioend->io_inode);
219 int error = 0; 219 int error = 0;
220 220
221 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { 221 /*
222 * Set an error if the mount has shut down and proceed with end I/O
223 * processing so it can perform whatever cleanups are necessary.
224 */
225 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
222 ioend->io_error = -EIO; 226 ioend->io_error = -EIO;
223 goto done;
224 }
225 227
226 /* 228 /*
227 * For unwritten extents we need to issue transactions to convert a 229 * For unwritten extents we need to issue transactions to convert a
@@ -1702,14 +1704,22 @@ xfs_vm_write_failed(
1702 if (block_start >= to) 1704 if (block_start >= to)
1703 break; 1705 break;
1704 1706
1705 if (!buffer_delay(bh)) 1707 /*
1708 * Process delalloc and unwritten buffers beyond EOF. We can
1709 * encounter unwritten buffers in the event that a file has
1710 * post-EOF unwritten extents and an extending write happens to
1711 * fail (e.g., an unaligned write that also involves a delalloc
1712 * to the same page).
1713 */
1714 if (!buffer_delay(bh) && !buffer_unwritten(bh))
1706 continue; 1715 continue;
1707 1716
1708 if (!buffer_new(bh) && block_offset < i_size_read(inode)) 1717 if (!buffer_new(bh) && block_offset < i_size_read(inode))
1709 continue; 1718 continue;
1710 1719
1711 xfs_vm_kill_delalloc_range(inode, block_offset, 1720 if (buffer_delay(bh))
1712 block_offset + bh->b_size); 1721 xfs_vm_kill_delalloc_range(inode, block_offset,
1722 block_offset + bh->b_size);
1713 1723
1714 /* 1724 /*
1715 * This buffer does not contain data anymore. make sure anyone 1725 * This buffer does not contain data anymore. make sure anyone
@@ -1720,6 +1730,7 @@ xfs_vm_write_failed(
1720 clear_buffer_mapped(bh); 1730 clear_buffer_mapped(bh);
1721 clear_buffer_new(bh); 1731 clear_buffer_new(bh);
1722 clear_buffer_dirty(bh); 1732 clear_buffer_dirty(bh);
1733 clear_buffer_unwritten(bh);
1723 } 1734 }
1724 1735
1725} 1736}
diff --git a/fs/xfs/xfs_fsops.h b/fs/xfs/xfs_fsops.h
index 1b6a98b66886..f32713f14f9a 100644
--- a/fs/xfs/xfs_fsops.h
+++ b/fs/xfs/xfs_fsops.h
@@ -25,6 +25,5 @@ extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt);
25extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval, 25extern int xfs_reserve_blocks(xfs_mount_t *mp, __uint64_t *inval,
26 xfs_fsop_resblks_t *outval); 26 xfs_fsop_resblks_t *outval);
27extern int xfs_fs_goingdown(xfs_mount_t *mp, __uint32_t inflags); 27extern int xfs_fs_goingdown(xfs_mount_t *mp, __uint32_t inflags);
28extern int xfs_fs_log_dummy(struct xfs_mount *mp);
29 28
30#endif /* __XFS_FSOPS_H__ */ 29#endif /* __XFS_FSOPS_H__ */
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index b57098481c10..a4e03ab50342 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -327,7 +327,6 @@ extern int xfs_mod_fdblocks(struct xfs_mount *mp, int64_t delta,
327 bool reserved); 327 bool reserved);
328extern int xfs_mod_frextents(struct xfs_mount *mp, int64_t delta); 328extern int xfs_mod_frextents(struct xfs_mount *mp, int64_t delta);
329 329
330extern int xfs_mount_log_sb(xfs_mount_t *);
331extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); 330extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
332extern int xfs_readsb(xfs_mount_t *, int); 331extern int xfs_readsb(xfs_mount_t *, int);
333extern void xfs_freesb(xfs_mount_t *); 332extern void xfs_freesb(xfs_mount_t *);
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 4f18fd92ca13..d6c9c3e9e02b 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -497,6 +497,7 @@ xfsaild(
497 long tout = 0; /* milliseconds */ 497 long tout = 0; /* milliseconds */
498 498
499 current->flags |= PF_MEMALLOC; 499 current->flags |= PF_MEMALLOC;
500 set_freezable();
500 501
501 while (!kthread_should_stop()) { 502 while (!kthread_should_stop()) {
502 if (tout && tout <= 20) 503 if (tout && tout <= 20)
@@ -519,14 +520,14 @@ xfsaild(
519 if (!xfs_ail_min(ailp) && 520 if (!xfs_ail_min(ailp) &&
520 ailp->xa_target == ailp->xa_target_prev) { 521 ailp->xa_target == ailp->xa_target_prev) {
521 spin_unlock(&ailp->xa_lock); 522 spin_unlock(&ailp->xa_lock);
522 schedule(); 523 freezable_schedule();
523 tout = 0; 524 tout = 0;
524 continue; 525 continue;
525 } 526 }
526 spin_unlock(&ailp->xa_lock); 527 spin_unlock(&ailp->xa_lock);
527 528
528 if (tout) 529 if (tout)
529 schedule_timeout(msecs_to_jiffies(tout)); 530 freezable_schedule_timeout(msecs_to_jiffies(tout));
530 531
531 __set_current_state(TASK_RUNNING); 532 __set_current_state(TASK_RUNNING);
532 533