mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-06 00:47:56 -04:00
bcachefs: Don't issue discards when in nochanges mode
When the nochanges option is selected, we're supposed to never issue writes. Unfortunately, it seems discards were missed when implemnting this, leading to some painful filesystem corruption. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
committed by
Kent Overstreet
parent
8ccf4dff09
commit
3117db99f3
@@ -801,7 +801,8 @@ static int push_invalidated_bucket(struct bch_fs *c, struct bch_dev *ca, u64 b)
|
||||
|
||||
static void discard_one_bucket(struct bch_fs *c, struct bch_dev *ca, u64 b)
|
||||
{
|
||||
if (ca->mi.discard &&
|
||||
if (!c->opts.nochanges &&
|
||||
ca->mi.discard &&
|
||||
bdev_max_discard_sectors(ca->disk_sb.bdev))
|
||||
blkdev_issue_discard(ca->disk_sb.bdev, bucket_to_sector(ca, b),
|
||||
ca->mi.bucket_size, GFP_NOFS);
|
||||
|
||||
@@ -286,7 +286,8 @@ void bch2_journal_do_discards(struct journal *j)
|
||||
struct journal_device *ja = &ca->journal;
|
||||
|
||||
while (should_discard_bucket(j, ja)) {
|
||||
if (ca->mi.discard &&
|
||||
if (!c->opts.nochanges &&
|
||||
ca->mi.discard &&
|
||||
bdev_max_discard_sectors(ca->disk_sb.bdev))
|
||||
blkdev_issue_discard(ca->disk_sb.bdev,
|
||||
bucket_to_sector(ca,
|
||||
|
||||
Reference in New Issue
Block a user