diff options
author | Christoph Hellwig <hch@lst.de> | 2010-09-16 14:51:46 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-16 14:52:58 -0400 |
commit | dd3932eddf428571762596e17b65f5dc92ca361b (patch) | |
tree | 57cec5ae2f862037f78b7e993323d77955bb6463 | |
parent | 8786fb70ccb36c7cff64680bb80c46d3a09d44db (diff) |
block: remove BLKDEV_IFL_WAIT
All the blkdev_issue_* helpers can only sanely be used for synchronous
caller. To issue cache flushes or barriers asynchronously the caller needs
to set up a bio by itself with a completion callback to move the asynchronous
state machine ahead. So drop the BLKDEV_IFL_WAIT flag that is always
specified when calling blkdev_issue_* and also remove the now unused flags
argument to blkdev_issue_flush and blkdev_issue_zeroout. For
blkdev_issue_discard we need to keep it for the secure discard flag, which
gains a more descriptive name and loses the bitops vs flag confusion.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r-- | block/blk-flush.c | 25 | ||||
-rw-r--r-- | block/blk-lib.c | 21 | ||||
-rw-r--r-- | block/ioctl.c | 4 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 | ||||
-rw-r--r-- | fs/ext3/fsync.c | 3 | ||||
-rw-r--r-- | fs/ext4/fsync.c | 5 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 3 | ||||
-rw-r--r-- | fs/fat/fatent.c | 3 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 5 | ||||
-rw-r--r-- | fs/jbd2/checkpoint.c | 3 | ||||
-rw-r--r-- | fs/jbd2/commit.c | 6 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/file.c | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 3 | ||||
-rw-r--r-- | include/linux/blkdev.h | 14 | ||||
-rw-r--r-- | mm/swapfile.c | 6 |
19 files changed, 47 insertions, 71 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index 62b7df9bca9d..54b123d6563e 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -205,7 +205,6 @@ static void bio_end_flush(struct bio *bio, int err) | |||
205 | * @bdev: blockdev to issue flush for | 205 | * @bdev: blockdev to issue flush for |
206 | * @gfp_mask: memory allocation flags (for bio_alloc) | 206 | * @gfp_mask: memory allocation flags (for bio_alloc) |
207 | * @error_sector: error sector | 207 | * @error_sector: error sector |
208 | * @flags: BLKDEV_IFL_* flags to control behaviour | ||
209 | * | 208 | * |
210 | * Description: | 209 | * Description: |
211 | * Issue a flush for the block device in question. Caller can supply | 210 | * Issue a flush for the block device in question. Caller can supply |
@@ -214,7 +213,7 @@ static void bio_end_flush(struct bio *bio, int err) | |||
214 | * request was pushed in some internal queue for later handling. | 213 | * request was pushed in some internal queue for later handling. |
215 | */ | 214 | */ |
216 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | 215 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, |
217 | sector_t *error_sector, unsigned long flags) | 216 | sector_t *error_sector) |
218 | { | 217 | { |
219 | DECLARE_COMPLETION_ONSTACK(wait); | 218 | DECLARE_COMPLETION_ONSTACK(wait); |
220 | struct request_queue *q; | 219 | struct request_queue *q; |
@@ -240,21 +239,19 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
240 | bio = bio_alloc(gfp_mask, 0); | 239 | bio = bio_alloc(gfp_mask, 0); |
241 | bio->bi_end_io = bio_end_flush; | 240 | bio->bi_end_io = bio_end_flush; |
242 | bio->bi_bdev = bdev; | 241 | bio->bi_bdev = bdev; |
243 | if (test_bit(BLKDEV_WAIT, &flags)) | 242 | bio->bi_private = &wait; |
244 | bio->bi_private = &wait; | ||
245 | 243 | ||
246 | bio_get(bio); | 244 | bio_get(bio); |
247 | submit_bio(WRITE_FLUSH, bio); | 245 | submit_bio(WRITE_FLUSH, bio); |
248 | if (test_bit(BLKDEV_WAIT, &flags)) { | 246 | wait_for_completion(&wait); |
249 | wait_for_completion(&wait); | 247 | |
250 | /* | 248 | /* |
251 | * The driver must store the error location in ->bi_sector, if | 249 | * The driver must store the error location in ->bi_sector, if |
252 | * it supports it. For non-stacked drivers, this should be | 250 | * it supports it. For non-stacked drivers, this should be |
253 | * copied from blk_rq_pos(rq). | 251 | * copied from blk_rq_pos(rq). |
254 | */ | 252 | */ |
255 | if (error_sector) | 253 | if (error_sector) |
256 | *error_sector = bio->bi_sector; | 254 | *error_sector = bio->bi_sector; |
257 | } | ||
258 | 255 | ||
259 | if (!bio_flagged(bio, BIO_UPTODATE)) | 256 | if (!bio_flagged(bio, BIO_UPTODATE)) |
260 | ret = -EIO; | 257 | ret = -EIO; |
diff --git a/block/blk-lib.c b/block/blk-lib.c index fe2e6ed0f510..1a320d2406b0 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -61,7 +61,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
61 | max_discard_sectors &= ~(disc_sects - 1); | 61 | max_discard_sectors &= ~(disc_sects - 1); |
62 | } | 62 | } |
63 | 63 | ||
64 | if (flags & BLKDEV_IFL_SECURE) { | 64 | if (flags & BLKDEV_DISCARD_SECURE) { |
65 | if (!blk_queue_secdiscard(q)) | 65 | if (!blk_queue_secdiscard(q)) |
66 | return -EOPNOTSUPP; | 66 | return -EOPNOTSUPP; |
67 | type |= REQ_SECURE; | 67 | type |= REQ_SECURE; |
@@ -77,8 +77,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
77 | bio->bi_sector = sector; | 77 | bio->bi_sector = sector; |
78 | bio->bi_end_io = blkdev_discard_end_io; | 78 | bio->bi_end_io = blkdev_discard_end_io; |
79 | bio->bi_bdev = bdev; | 79 | bio->bi_bdev = bdev; |
80 | if (flags & BLKDEV_IFL_WAIT) | 80 | bio->bi_private = &wait; |
81 | bio->bi_private = &wait; | ||
82 | 81 | ||
83 | if (nr_sects > max_discard_sectors) { | 82 | if (nr_sects > max_discard_sectors) { |
84 | bio->bi_size = max_discard_sectors << 9; | 83 | bio->bi_size = max_discard_sectors << 9; |
@@ -92,8 +91,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
92 | bio_get(bio); | 91 | bio_get(bio); |
93 | submit_bio(type, bio); | 92 | submit_bio(type, bio); |
94 | 93 | ||
95 | if (flags & BLKDEV_IFL_WAIT) | 94 | wait_for_completion(&wait); |
96 | wait_for_completion(&wait); | ||
97 | 95 | ||
98 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) | 96 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) |
99 | ret = -EOPNOTSUPP; | 97 | ret = -EOPNOTSUPP; |
@@ -139,7 +137,6 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
139 | * @sector: start sector | 137 | * @sector: start sector |
140 | * @nr_sects: number of sectors to write | 138 | * @nr_sects: number of sectors to write |
141 | * @gfp_mask: memory allocation flags (for bio_alloc) | 139 | * @gfp_mask: memory allocation flags (for bio_alloc) |
142 | * @flags: BLKDEV_IFL_* flags to control behaviour | ||
143 | * | 140 | * |
144 | * Description: | 141 | * Description: |
145 | * Generate and issue number of bios with zerofiled pages. | 142 | * Generate and issue number of bios with zerofiled pages. |
@@ -148,7 +145,7 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
148 | */ | 145 | */ |
149 | 146 | ||
150 | int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | 147 | int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, |
151 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags) | 148 | sector_t nr_sects, gfp_t gfp_mask) |
152 | { | 149 | { |
153 | int ret; | 150 | int ret; |
154 | struct bio *bio; | 151 | struct bio *bio; |
@@ -174,8 +171,7 @@ submit: | |||
174 | bio->bi_sector = sector; | 171 | bio->bi_sector = sector; |
175 | bio->bi_bdev = bdev; | 172 | bio->bi_bdev = bdev; |
176 | bio->bi_end_io = bio_batch_end_io; | 173 | bio->bi_end_io = bio_batch_end_io; |
177 | if (flags & BLKDEV_IFL_WAIT) | 174 | bio->bi_private = &bb; |
178 | bio->bi_private = &bb; | ||
179 | 175 | ||
180 | while (nr_sects != 0) { | 176 | while (nr_sects != 0) { |
181 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); | 177 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); |
@@ -193,10 +189,9 @@ submit: | |||
193 | submit_bio(WRITE, bio); | 189 | submit_bio(WRITE, bio); |
194 | } | 190 | } |
195 | 191 | ||
196 | if (flags & BLKDEV_IFL_WAIT) | 192 | /* Wait for bios in-flight */ |
197 | /* Wait for bios in-flight */ | 193 | while (issued != atomic_read(&bb.done)) |
198 | while ( issued != atomic_read(&bb.done)) | 194 | wait_for_completion(&wait); |
199 | wait_for_completion(&wait); | ||
200 | 195 | ||
201 | if (!test_bit(BIO_UPTODATE, &bb.flags)) | 196 | if (!test_bit(BIO_UPTODATE, &bb.flags)) |
202 | /* One of bios in the batch was completed with error.*/ | 197 | /* One of bios in the batch was completed with error.*/ |
diff --git a/block/ioctl.c b/block/ioctl.c index d8052f0dabd3..cb2b9099862b 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -116,7 +116,7 @@ static int blkdev_reread_part(struct block_device *bdev) | |||
116 | static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, | 116 | static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, |
117 | uint64_t len, int secure) | 117 | uint64_t len, int secure) |
118 | { | 118 | { |
119 | unsigned long flags = BLKDEV_IFL_WAIT; | 119 | unsigned long flags = 0; |
120 | 120 | ||
121 | if (start & 511) | 121 | if (start & 511) |
122 | return -EINVAL; | 122 | return -EINVAL; |
@@ -128,7 +128,7 @@ static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, | |||
128 | if (start + len > (bdev->bd_inode->i_size >> 9)) | 128 | if (start + len > (bdev->bd_inode->i_size >> 9)) |
129 | return -EINVAL; | 129 | return -EINVAL; |
130 | if (secure) | 130 | if (secure) |
131 | flags |= BLKDEV_IFL_SECURE; | 131 | flags |= BLKDEV_DISCARD_SECURE; |
132 | return blkdev_issue_discard(bdev, start, len, GFP_KERNEL, flags); | 132 | return blkdev_issue_discard(bdev, start, len, GFP_KERNEL, flags); |
133 | } | 133 | } |
134 | 134 | ||
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 352441b0f92f..c2ef476f5711 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -2321,8 +2321,7 @@ static inline void drbd_md_flush(struct drbd_conf *mdev) | |||
2321 | if (test_bit(MD_NO_BARRIER, &mdev->flags)) | 2321 | if (test_bit(MD_NO_BARRIER, &mdev->flags)) |
2322 | return; | 2322 | return; |
2323 | 2323 | ||
2324 | r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL, | 2324 | r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL); |
2325 | BLKDEV_IFL_WAIT); | ||
2326 | if (r) { | 2325 | if (r) { |
2327 | set_bit(MD_NO_BARRIER, &mdev->flags); | 2326 | set_bit(MD_NO_BARRIER, &mdev->flags); |
2328 | dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r); | 2327 | dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r); |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 081522d3c742..df15e7f0e7b7 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -975,7 +975,7 @@ static enum finish_epoch drbd_flush_after_epoch(struct drbd_conf *mdev, struct d | |||
975 | 975 | ||
976 | if (mdev->write_ordering >= WO_bdev_flush && get_ldev(mdev)) { | 976 | if (mdev->write_ordering >= WO_bdev_flush && get_ldev(mdev)) { |
977 | rv = blkdev_issue_flush(mdev->ldev->backing_bdev, GFP_KERNEL, | 977 | rv = blkdev_issue_flush(mdev->ldev->backing_bdev, GFP_KERNEL, |
978 | NULL, BLKDEV_IFL_WAIT); | 978 | NULL); |
979 | if (rv) { | 979 | if (rv) { |
980 | dev_err(DEV, "local disk flush failed with status %d\n", rv); | 980 | dev_err(DEV, "local disk flush failed with status %d\n", rv); |
981 | /* would rather check on EOPNOTSUPP, but that is not reliable. | 981 | /* would rather check on EOPNOTSUPP, but that is not reliable. |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 50e8c8582faa..b737451e2e9d 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -370,7 +370,7 @@ int blkdev_fsync(struct file *filp, int datasync) | |||
370 | */ | 370 | */ |
371 | mutex_unlock(&bd_inode->i_mutex); | 371 | mutex_unlock(&bd_inode->i_mutex); |
372 | 372 | ||
373 | error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL, BLKDEV_IFL_WAIT); | 373 | error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL); |
374 | if (error == -EOPNOTSUPP) | 374 | if (error == -EOPNOTSUPP) |
375 | error = 0; | 375 | error = 0; |
376 | 376 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 43dc9ea9aef6..0b81ecdb101c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1695,8 +1695,7 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans, | |||
1695 | static void btrfs_issue_discard(struct block_device *bdev, | 1695 | static void btrfs_issue_discard(struct block_device *bdev, |
1696 | u64 start, u64 len) | 1696 | u64 start, u64 len) |
1697 | { | 1697 | { |
1698 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, | 1698 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 0); |
1699 | BLKDEV_IFL_WAIT); | ||
1700 | } | 1699 | } |
1701 | 1700 | ||
1702 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | 1701 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, |
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index d7e9f74dc3a6..09b13bb34c94 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -90,7 +90,6 @@ int ext3_sync_file(struct file *file, int datasync) | |||
90 | * storage | 90 | * storage |
91 | */ | 91 | */ |
92 | if (needs_barrier) | 92 | if (needs_barrier) |
93 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL, | 93 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
94 | BLKDEV_IFL_WAIT); | ||
95 | return ret; | 94 | return ret; |
96 | } | 95 | } |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 592adf2e546e..3f3ff5ee8f9d 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -128,10 +128,9 @@ int ext4_sync_file(struct file *file, int datasync) | |||
128 | (journal->j_fs_dev != journal->j_dev) && | 128 | (journal->j_fs_dev != journal->j_dev) && |
129 | (journal->j_flags & JBD2_BARRIER)) | 129 | (journal->j_flags & JBD2_BARRIER)) |
130 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, | 130 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, |
131 | NULL, BLKDEV_IFL_WAIT); | 131 | NULL); |
132 | ret = jbd2_log_wait_commit(journal, commit_tid); | 132 | ret = jbd2_log_wait_commit(journal, commit_tid); |
133 | } else if (journal->j_flags & JBD2_BARRIER) | 133 | } else if (journal->j_flags & JBD2_BARRIER) |
134 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL, | 134 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
135 | BLKDEV_IFL_WAIT); | ||
136 | return ret; | 135 | return ret; |
137 | } | 136 | } |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index a22bfef3da95..19aa0d44d822 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2566,8 +2566,7 @@ static inline void ext4_issue_discard(struct super_block *sb, | |||
2566 | discard_block = block + ext4_group_first_block_no(sb, block_group); | 2566 | discard_block = block + ext4_group_first_block_no(sb, block_group); |
2567 | trace_ext4_discard_blocks(sb, | 2567 | trace_ext4_discard_blocks(sb, |
2568 | (unsigned long long) discard_block, count); | 2568 | (unsigned long long) discard_block, count); |
2569 | ret = sb_issue_discard(sb, discard_block, count, GFP_NOFS, | 2569 | ret = sb_issue_discard(sb, discard_block, count, GFP_NOFS, 0); |
2570 | BLKDEV_IFL_WAIT); | ||
2571 | if (ret == EOPNOTSUPP) { | 2570 | if (ret == EOPNOTSUPP) { |
2572 | ext4_warning(sb, "discard not supported, disabling"); | 2571 | ext4_warning(sb, "discard not supported, disabling"); |
2573 | clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD); | 2572 | clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD); |
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index f9a0b7ae8648..b47d2c9f4fa1 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
@@ -578,8 +578,7 @@ int fat_free_clusters(struct inode *inode, int cluster) | |||
578 | sb_issue_discard(sb, | 578 | sb_issue_discard(sb, |
579 | fat_clus_to_blknr(sbi, first_cl), | 579 | fat_clus_to_blknr(sbi, first_cl), |
580 | nr_clus * sbi->sec_per_clus, | 580 | nr_clus * sbi->sec_per_clus, |
581 | GFP_NOFS, | 581 | GFP_NOFS, 0); |
582 | BLKDEV_IFL_WAIT); | ||
583 | 582 | ||
584 | first_cl = cluster; | 583 | first_cl = cluster; |
585 | } | 584 | } |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 379316472918..38b3ea1abacc 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -854,7 +854,7 @@ static void gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, | |||
854 | if ((start + nr_sects) != blk) { | 854 | if ((start + nr_sects) != blk) { |
855 | rv = blkdev_issue_discard(bdev, start, | 855 | rv = blkdev_issue_discard(bdev, start, |
856 | nr_sects, GFP_NOFS, | 856 | nr_sects, GFP_NOFS, |
857 | BLKDEV_IFL_WAIT); | 857 | 0); |
858 | if (rv) | 858 | if (rv) |
859 | goto fail; | 859 | goto fail; |
860 | nr_sects = 0; | 860 | nr_sects = 0; |
@@ -868,8 +868,7 @@ start_new_extent: | |||
868 | } | 868 | } |
869 | } | 869 | } |
870 | if (nr_sects) { | 870 | if (nr_sects) { |
871 | rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, | 871 | rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, 0); |
872 | BLKDEV_IFL_WAIT); | ||
873 | if (rv) | 872 | if (rv) |
874 | goto fail; | 873 | goto fail; |
875 | } | 874 | } |
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 5247e7ffdcb4..6571a056e55d 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -532,8 +532,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal) | |||
532 | */ | 532 | */ |
533 | if ((journal->j_fs_dev != journal->j_dev) && | 533 | if ((journal->j_fs_dev != journal->j_dev) && |
534 | (journal->j_flags & JBD2_BARRIER)) | 534 | (journal->j_flags & JBD2_BARRIER)) |
535 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL, | 535 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); |
536 | BLKDEV_IFL_WAIT); | ||
537 | if (!(journal->j_flags & JBD2_ABORT)) | 536 | if (!(journal->j_flags & JBD2_ABORT)) |
538 | jbd2_journal_update_superblock(journal, 1); | 537 | jbd2_journal_update_superblock(journal, 1); |
539 | return 0; | 538 | return 0; |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index f204e27f44d1..cb43c605cfaa 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -684,8 +684,7 @@ start_journal_io: | |||
684 | if (commit_transaction->t_flushed_data_blocks && | 684 | if (commit_transaction->t_flushed_data_blocks && |
685 | (journal->j_fs_dev != journal->j_dev) && | 685 | (journal->j_fs_dev != journal->j_dev) && |
686 | (journal->j_flags & JBD2_BARRIER)) | 686 | (journal->j_flags & JBD2_BARRIER)) |
687 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL, | 687 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); |
688 | BLKDEV_IFL_WAIT); | ||
689 | 688 | ||
690 | /* Done it all: now write the commit record asynchronously. */ | 689 | /* Done it all: now write the commit record asynchronously. */ |
691 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 690 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
@@ -810,8 +809,7 @@ wait_for_iobuf: | |||
810 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 809 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
811 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | 810 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && |
812 | journal->j_flags & JBD2_BARRIER) { | 811 | journal->j_flags & JBD2_BARRIER) { |
813 | blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL, | 812 | blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL); |
814 | BLKDEV_IFL_WAIT); | ||
815 | } | 813 | } |
816 | 814 | ||
817 | if (err) | 815 | if (err) |
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 400b2caef4d8..d97310f07bef 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -774,7 +774,7 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump, | |||
774 | ret = blkdev_issue_discard(nilfs->ns_bdev, | 774 | ret = blkdev_issue_discard(nilfs->ns_bdev, |
775 | start * sects_per_block, | 775 | start * sects_per_block, |
776 | nblocks * sects_per_block, | 776 | nblocks * sects_per_block, |
777 | GFP_NOFS, BLKDEV_IFL_WAIT); | 777 | GFP_NOFS, 0); |
778 | if (ret < 0) | 778 | if (ret < 0) |
779 | return ret; | 779 | return ret; |
780 | nblocks = 0; | 780 | nblocks = 0; |
@@ -784,7 +784,7 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump, | |||
784 | ret = blkdev_issue_discard(nilfs->ns_bdev, | 784 | ret = blkdev_issue_discard(nilfs->ns_bdev, |
785 | start * sects_per_block, | 785 | start * sects_per_block, |
786 | nblocks * sects_per_block, | 786 | nblocks * sects_per_block, |
787 | GFP_NOFS, BLKDEV_IFL_WAIT); | 787 | GFP_NOFS, 0); |
788 | return ret; | 788 | return ret; |
789 | } | 789 | } |
790 | 790 | ||
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 6846371498b6..91f080cc76c8 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -152,8 +152,7 @@ static int reiserfs_sync_file(struct file *filp, int datasync) | |||
152 | barrier_done = reiserfs_commit_for_inode(inode); | 152 | barrier_done = reiserfs_commit_for_inode(inode); |
153 | reiserfs_write_unlock(inode->i_sb); | 153 | reiserfs_write_unlock(inode->i_sb); |
154 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) | 154 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) |
155 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL, | 155 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
156 | BLKDEV_IFL_WAIT); | ||
157 | if (barrier_done < 0) | 156 | if (barrier_done < 0) |
158 | return barrier_done; | 157 | return barrier_done; |
159 | return (err < 0) ? -EIO : 0; | 158 | return (err < 0) ? -EIO : 0; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 15c35b62ff14..5fa7a30cc3f0 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -693,8 +693,7 @@ void | |||
693 | xfs_blkdev_issue_flush( | 693 | xfs_blkdev_issue_flush( |
694 | xfs_buftarg_t *buftarg) | 694 | xfs_buftarg_t *buftarg) |
695 | { | 695 | { |
696 | blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL, | 696 | blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL); |
697 | BLKDEV_IFL_WAIT); | ||
698 | } | 697 | } |
699 | 698 | ||
700 | STATIC void | 699 | STATIC void |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index cfcb3a610605..accbd0e5c893 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -867,18 +867,14 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | |||
867 | return NULL; | 867 | return NULL; |
868 | return bqt->tag_index[tag]; | 868 | return bqt->tag_index[tag]; |
869 | } | 869 | } |
870 | enum{ | 870 | |
871 | BLKDEV_WAIT, /* wait for completion */ | 871 | #define BLKDEV_DISCARD_SECURE 0x01 /* secure discard */ |
872 | BLKDEV_SECURE, /* secure discard */ | 872 | |
873 | }; | 873 | extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *); |
874 | #define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) | ||
875 | #define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE) | ||
876 | extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, | ||
877 | unsigned long); | ||
878 | extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | 874 | extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, |
879 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); | 875 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); |
880 | extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | 876 | extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, |
881 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); | 877 | sector_t nr_sects, gfp_t gfp_mask); |
882 | static inline int sb_issue_discard(struct super_block *sb, sector_t block, | 878 | static inline int sb_issue_discard(struct super_block *sb, sector_t block, |
883 | sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags) | 879 | sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags) |
884 | { | 880 | { |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 68cda164dff6..e132e1708acc 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -141,7 +141,7 @@ static int discard_swap(struct swap_info_struct *si) | |||
141 | nr_blocks = ((sector_t)se->nr_pages - 1) << (PAGE_SHIFT - 9); | 141 | nr_blocks = ((sector_t)se->nr_pages - 1) << (PAGE_SHIFT - 9); |
142 | if (nr_blocks) { | 142 | if (nr_blocks) { |
143 | err = blkdev_issue_discard(si->bdev, start_block, | 143 | err = blkdev_issue_discard(si->bdev, start_block, |
144 | nr_blocks, GFP_KERNEL, BLKDEV_IFL_WAIT); | 144 | nr_blocks, GFP_KERNEL, 0); |
145 | if (err) | 145 | if (err) |
146 | return err; | 146 | return err; |
147 | cond_resched(); | 147 | cond_resched(); |
@@ -152,7 +152,7 @@ static int discard_swap(struct swap_info_struct *si) | |||
152 | nr_blocks = (sector_t)se->nr_pages << (PAGE_SHIFT - 9); | 152 | nr_blocks = (sector_t)se->nr_pages << (PAGE_SHIFT - 9); |
153 | 153 | ||
154 | err = blkdev_issue_discard(si->bdev, start_block, | 154 | err = blkdev_issue_discard(si->bdev, start_block, |
155 | nr_blocks, GFP_KERNEL, BLKDEV_IFL_WAIT); | 155 | nr_blocks, GFP_KERNEL, 0); |
156 | if (err) | 156 | if (err) |
157 | break; | 157 | break; |
158 | 158 | ||
@@ -191,7 +191,7 @@ static void discard_swap_cluster(struct swap_info_struct *si, | |||
191 | start_block <<= PAGE_SHIFT - 9; | 191 | start_block <<= PAGE_SHIFT - 9; |
192 | nr_blocks <<= PAGE_SHIFT - 9; | 192 | nr_blocks <<= PAGE_SHIFT - 9; |
193 | if (blkdev_issue_discard(si->bdev, start_block, | 193 | if (blkdev_issue_discard(si->bdev, start_block, |
194 | nr_blocks, GFP_NOIO, BLKDEV_IFL_WAIT)) | 194 | nr_blocks, GFP_NOIO, 0)) |
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | 197 | ||