diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
| -rw-r--r-- | fs/btrfs/extent_io.c | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c123a3ef154a..23273d0e6f22 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -973,7 +973,7 @@ static void btrfs_readahead_expand(struct readahead_control *ractl,  {  	const u64 ra_pos = readahead_pos(ractl);  	const u64 ra_end = ra_pos + readahead_length(ractl); -	const u64 em_end = em->start + em->ram_bytes; +	const u64 em_end = em->start + em->len;  	/* No expansion for holes and inline extents. */  	if (em->disk_bytenr > EXTENT_MAP_LAST_BYTE) @@ -2228,6 +2228,14 @@ static noinline_for_stack void write_one_eb(struct extent_buffer *eb,  		wbc_account_cgroup_owner(wbc, folio, range_len);  		folio_unlock(folio);  	} +	/* +	 * If the fs is already in error status, do not submit any writeback +	 * but immediately finish it. +	 */ +	if (unlikely(BTRFS_FS_ERROR(fs_info))) { +		btrfs_bio_end_io(bbio, errno_to_blk_status(BTRFS_FS_ERROR(fs_info))); +		return; +	}  	btrfs_submit_bbio(bbio, 0);  }  | 
