Re: [PATCH] btrfs-progs: balance: Sync the fs before balancing metadata chunks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 29, 2019 at 02:57:39PM +0800, Qu Wenruo wrote:
> The most straightforward is to sync the fs before balancing metadata
> chunks.
> 
> We could enhance the kernel bytes_may_use calculation, but I doubt about
> the complexity.
> So I take the easy fix to reduce the false ENOSPC reports.

Agreed.

> +	/*
> +	 * There may be many over-reserved space for metadata block groups,
> +	 * especially for inlined file extents.
> +	 *
> +	 * Do a sync here will free those over-reserved space and hugely
> +	 * reduce the possibility of some false ENOSPC
> +	 */
> +	if (args->flags & BTRFS_BALANCE_METADATA) {
> +		ret = btrfs_util_sync(path);

As the fd is already open, we should use the _fd version,

> +		if (ret) {
> +			error("failed to sync the fs before balance: %m");
> +			ret = -errno;
> +			goto out;

and possibly only warn if there's an error returned as the sync failure
is not a critical condition.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux