diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-08-18 05:29:12 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-10 06:35:39 -0400 |
commit | c3b9a62c8f932f32a733d6b628f61f3f28345727 (patch) | |
tree | 623a150079db7883444cc404ffcc1e0af4b80b7a /fs/btrfs | |
parent | 80f6c29d8a758650d5c9eac05074b4b3e8c266df (diff) |
btrfs: replace barriers with explicit flush / FUA usage
Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
detection for barriers and stop setting the barrier flag for discards.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/disk-io.c | 19 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 4 | ||||
-rw-r--r-- | fs/btrfs/volumes.h | 1 |
4 files changed, 5 insertions, 21 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 64f10082f048..5e789f4a3ed0 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2063,7 +2063,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate) | |||
2063 | if (uptodate) { | 2063 | if (uptodate) { |
2064 | set_buffer_uptodate(bh); | 2064 | set_buffer_uptodate(bh); |
2065 | } else { | 2065 | } else { |
2066 | if (!buffer_eopnotsupp(bh) && printk_ratelimit()) { | 2066 | if (printk_ratelimit()) { |
2067 | printk(KERN_WARNING "lost page write due to " | 2067 | printk(KERN_WARNING "lost page write due to " |
2068 | "I/O error on %s\n", | 2068 | "I/O error on %s\n", |
2069 | bdevname(bh->b_bdev, b)); | 2069 | bdevname(bh->b_bdev, b)); |
@@ -2200,21 +2200,10 @@ static int write_dev_supers(struct btrfs_device *device, | |||
2200 | bh->b_end_io = btrfs_end_buffer_write_sync; | 2200 | bh->b_end_io = btrfs_end_buffer_write_sync; |
2201 | } | 2201 | } |
2202 | 2202 | ||
2203 | if (i == last_barrier && do_barriers && device->barriers) { | 2203 | if (i == last_barrier && do_barriers) |
2204 | ret = submit_bh(WRITE_BARRIER, bh); | 2204 | ret = submit_bh(WRITE_FLUSH_FUA, bh); |
2205 | if (ret == -EOPNOTSUPP) { | 2205 | else |
2206 | printk("btrfs: disabling barriers on dev %s\n", | ||
2207 | device->name); | ||
2208 | set_buffer_uptodate(bh); | ||
2209 | device->barriers = 0; | ||
2210 | /* one reference for submit_bh */ | ||
2211 | get_bh(bh); | ||
2212 | lock_buffer(bh); | ||
2213 | ret = submit_bh(WRITE_SYNC, bh); | ||
2214 | } | ||
2215 | } else { | ||
2216 | ret = submit_bh(WRITE_SYNC, bh); | 2206 | ret = submit_bh(WRITE_SYNC, bh); |
2217 | } | ||
2218 | 2207 | ||
2219 | if (ret) | 2208 | if (ret) |
2220 | errors++; | 2209 | errors++; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 32d094002a57..43dc9ea9aef6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1696,7 +1696,7 @@ 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, |
1699 | BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); | 1699 | BLKDEV_IFL_WAIT); |
1700 | } | 1700 | } |
1701 | 1701 | ||
1702 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | 1702 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index dd318ff280b2..e25e46a8b4e2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -398,7 +398,6 @@ static noinline int device_list_add(const char *path, | |||
398 | device->work.func = pending_bios_fn; | 398 | device->work.func = pending_bios_fn; |
399 | memcpy(device->uuid, disk_super->dev_item.uuid, | 399 | memcpy(device->uuid, disk_super->dev_item.uuid, |
400 | BTRFS_UUID_SIZE); | 400 | BTRFS_UUID_SIZE); |
401 | device->barriers = 1; | ||
402 | spin_lock_init(&device->io_lock); | 401 | spin_lock_init(&device->io_lock); |
403 | device->name = kstrdup(path, GFP_NOFS); | 402 | device->name = kstrdup(path, GFP_NOFS); |
404 | if (!device->name) { | 403 | if (!device->name) { |
@@ -462,7 +461,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | |||
462 | device->devid = orig_dev->devid; | 461 | device->devid = orig_dev->devid; |
463 | device->work.func = pending_bios_fn; | 462 | device->work.func = pending_bios_fn; |
464 | memcpy(device->uuid, orig_dev->uuid, sizeof(device->uuid)); | 463 | memcpy(device->uuid, orig_dev->uuid, sizeof(device->uuid)); |
465 | device->barriers = 1; | ||
466 | spin_lock_init(&device->io_lock); | 464 | spin_lock_init(&device->io_lock); |
467 | INIT_LIST_HEAD(&device->dev_list); | 465 | INIT_LIST_HEAD(&device->dev_list); |
468 | INIT_LIST_HEAD(&device->dev_alloc_list); | 466 | INIT_LIST_HEAD(&device->dev_alloc_list); |
@@ -1489,7 +1487,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1489 | trans = btrfs_start_transaction(root, 0); | 1487 | trans = btrfs_start_transaction(root, 0); |
1490 | lock_chunks(root); | 1488 | lock_chunks(root); |
1491 | 1489 | ||
1492 | device->barriers = 1; | ||
1493 | device->writeable = 1; | 1490 | device->writeable = 1; |
1494 | device->work.func = pending_bios_fn; | 1491 | device->work.func = pending_bios_fn; |
1495 | generate_random_uuid(device->uuid); | 1492 | generate_random_uuid(device->uuid); |
@@ -3084,7 +3081,6 @@ static struct btrfs_device *add_missing_dev(struct btrfs_root *root, | |||
3084 | return NULL; | 3081 | return NULL; |
3085 | list_add(&device->dev_list, | 3082 | list_add(&device->dev_list, |
3086 | &fs_devices->devices); | 3083 | &fs_devices->devices); |
3087 | device->barriers = 1; | ||
3088 | device->dev_root = root->fs_info->dev_root; | 3084 | device->dev_root = root->fs_info->dev_root; |
3089 | device->devid = devid; | 3085 | device->devid = devid; |
3090 | device->work.func = pending_bios_fn; | 3086 | device->work.func = pending_bios_fn; |
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 31b0fabdd2ea..2b638b6e4eea 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -42,7 +42,6 @@ struct btrfs_device { | |||
42 | int running_pending; | 42 | int running_pending; |
43 | u64 generation; | 43 | u64 generation; |
44 | 44 | ||
45 | int barriers; | ||
46 | int writeable; | 45 | int writeable; |
47 | int in_fs_metadata; | 46 | int in_fs_metadata; |
48 | 47 | ||