Re: [PATCH] Btrfs: fix our overcommit math

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

 



> +	used = space_info->bytes_used + space_info->bytes_reserved +
> +		space_info->bytes_pinned + space_info->bytes_readonly +
> +		space_info->bytes_may_use;
> +		spin_lock(&root->fs_info->free_chunk_lock);
> +	avail = root->fs_info->free_chunk_space;

Is that lock only protecting the read of free_chunk_space?  Might as
well just acquire and release around that and get all that local math
out of the critical section?

(I first thought the spin_lock() was accidentally dropped until I saw it
hiding all tabbed in and smushed against the used assignment.)

>  		spin_lock(&space_info->lock);
> -		if (space_info->bytes_used + space_info->bytes_reserved +
> -		    space_info->bytes_pinned + space_info->bytes_readonly +
> -		    space_info->bytes_may_use + orig <=
> -		    space_info->total_bytes) {
> +		if (can_overcommit(root, space_info, orig, !trans)) {
>  			spin_unlock(&space_info->lock);

*spots lock nesting, puts on his "only guy who runs with lockdep"
worrying hat*

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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