Re: [PATCH 03/21] btrfs: make the delalloc block rsv per inode

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

 



On Fri, Oct 13, 2017 at 02:47:32PM +0300, Nikolay Borisov wrote:
> 
> 
> > @@ -8848,7 +8849,6 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
> >  	if (iov_iter_rw(iter) == WRITE) {
> >  		up_read(&BTRFS_I(inode)->dio_sem);
> >  		current->journal_info = NULL;
> > -		btrfs_delalloc_release_extents(BTRFS_I(inode), count);
> >  		if (ret < 0 && ret != -EIOCBQUEUED) {
> >  			if (dio_data.reserve)
> >  				btrfs_delalloc_release_space(inode, data_reserved,
> > @@ -8869,6 +8869,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
> >  		} else if (ret >= 0 && (size_t)ret < count)
> >  			btrfs_delalloc_release_space(inode, data_reserved,
> >  					offset, count - (size_t)ret);
> 
> In case we didn't manage to write everything we are releasing the extra
> stuff that wasn't written.
> 
> > +		btrfs_delalloc_release_extents(BTRFS_I(inode), count);
> In case btrfs_delalloc_release_space triggered wouldn't freeing metadata
> here cause some sort of an underflow? Shouldn't we adjust count in case
> we have already freed anything beforehand?
> 

No, btrfs_delalloc_release_extents() is only for modifying the
outstanding_extents and adjusting the reservation,
btrfs_delalloc_release_space() takes care of the outstanding csum_bytes and
adjusts the reservation.  Thanks,

Josef
--
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