diff mbox series

[8/8] btrfs: remove orig_bytes from reserve_ticket

Message ID 20190816141952.19369-9-josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Rework reserve ticket handling | expand

Commit Message

Josef Bacik Aug. 16, 2019, 2:19 p.m. UTC
Now that we do not do partial filling of tickets simply remove
orig_bytes, it is no longer needed.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/space-info.c | 15 ---------------
 fs/btrfs/space-info.h |  1 -
 2 files changed, 16 deletions(-)

Comments

Nikolay Borisov Aug. 20, 2019, 8:28 a.m. UTC | #1
On 16.08.19 г. 17:19 ч., Josef Bacik wrote:
> Now that we do not do partial filling of tickets simply remove
> orig_bytes, it is no longer needed.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

nit: I think this patch should follow directly after 'btrfs: rework
wake_all_tickets' or it could even be squashed in it. But let's see how
David will prefer it.

> ---
>  fs/btrfs/space-info.c | 15 ---------------
>  fs/btrfs/space-info.h |  1 -
>  2 files changed, 16 deletions(-)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index f79afdc04925..c8867a0d9f5a 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -856,7 +856,6 @@ static int wait_reserve_ticket(struct btrfs_fs_info *fs_info,
>  
>  {
>  	DEFINE_WAIT(wait);
> -	u64 reclaim_bytes = 0;
>  	int ret = 0;
>  
>  	spin_lock(&space_info->lock);
> @@ -877,13 +876,7 @@ static int wait_reserve_ticket(struct btrfs_fs_info *fs_info,
>  		ret = ticket->error;
>  	if (!list_empty(&ticket->list))
>  		list_del_init(&ticket->list);
> -	if (ticket->bytes && ticket->bytes < ticket->orig_bytes)
> -		reclaim_bytes = ticket->orig_bytes - ticket->bytes;
>  	spin_unlock(&space_info->lock);
> -
> -	if (reclaim_bytes)
> -		btrfs_space_info_add_old_bytes(fs_info, space_info,
> -					       reclaim_bytes);
>  	return ret;
>  }
>  
> @@ -909,7 +902,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
>  {
>  	struct reserve_ticket ticket;
>  	u64 used;
> -	u64 reclaim_bytes = 0;
>  	int ret = 0;
>  	bool pending_tickets;
>  
> @@ -943,7 +935,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
>  	 * the list and we will do our own flushing further down.
>  	 */
>  	if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
> -		ticket.orig_bytes = orig_bytes;
>  		ticket.bytes = orig_bytes;
>  		ticket.error = 0;
>  		init_waitqueue_head(&ticket.wait);
> @@ -990,16 +981,10 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
>  	priority_reclaim_metadata_space(fs_info, space_info, &ticket);
>  	spin_lock(&space_info->lock);
>  	if (ticket.bytes) {
> -		if (ticket.bytes < orig_bytes)
> -			reclaim_bytes = orig_bytes - ticket.bytes;
>  		list_del_init(&ticket.list);
>  		ret = -ENOSPC;
>  	}
>  	spin_unlock(&space_info->lock);
> -
> -	if (reclaim_bytes)
> -		btrfs_space_info_add_old_bytes(fs_info, space_info,
> -					       reclaim_bytes);
>  	ASSERT(list_empty(&ticket.list));
>  	return ret;
>  }
> diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
> index 9ae5cae52fde..ebc5b407a954 100644
> --- a/fs/btrfs/space-info.h
> +++ b/fs/btrfs/space-info.h
> @@ -70,7 +70,6 @@ struct btrfs_space_info {
>  };
>  
>  struct reserve_ticket {
> -	u64 orig_bytes;
>  	u64 bytes;
>  	int error;
>  	struct list_head list;
>
David Sterba Aug. 21, 2019, 2:07 p.m. UTC | #2
On Tue, Aug 20, 2019 at 11:28:54AM +0300, Nikolay Borisov wrote:
> 
> 
> On 16.08.19 г. 17:19 ч., Josef Bacik wrote:
> > Now that we do not do partial filling of tickets simply remove
> > orig_bytes, it is no longer needed.
> > 
> > Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> 
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> 
> nit: I think this patch should follow directly after 'btrfs: rework
> wake_all_tickets' or it could even be squashed in it. But let's see how
> David will prefer it.

The patch does not apply on current misc-next + the ticket series, but
looking at the patches as they are now, the separation seems ok. 8
depends on 7 so the unused code cleanup is not in the fix.
diff mbox series

Patch

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index f79afdc04925..c8867a0d9f5a 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -856,7 +856,6 @@  static int wait_reserve_ticket(struct btrfs_fs_info *fs_info,
 
 {
 	DEFINE_WAIT(wait);
-	u64 reclaim_bytes = 0;
 	int ret = 0;
 
 	spin_lock(&space_info->lock);
@@ -877,13 +876,7 @@  static int wait_reserve_ticket(struct btrfs_fs_info *fs_info,
 		ret = ticket->error;
 	if (!list_empty(&ticket->list))
 		list_del_init(&ticket->list);
-	if (ticket->bytes && ticket->bytes < ticket->orig_bytes)
-		reclaim_bytes = ticket->orig_bytes - ticket->bytes;
 	spin_unlock(&space_info->lock);
-
-	if (reclaim_bytes)
-		btrfs_space_info_add_old_bytes(fs_info, space_info,
-					       reclaim_bytes);
 	return ret;
 }
 
@@ -909,7 +902,6 @@  static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
 {
 	struct reserve_ticket ticket;
 	u64 used;
-	u64 reclaim_bytes = 0;
 	int ret = 0;
 	bool pending_tickets;
 
@@ -943,7 +935,6 @@  static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
 	 * the list and we will do our own flushing further down.
 	 */
 	if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
-		ticket.orig_bytes = orig_bytes;
 		ticket.bytes = orig_bytes;
 		ticket.error = 0;
 		init_waitqueue_head(&ticket.wait);
@@ -990,16 +981,10 @@  static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
 	priority_reclaim_metadata_space(fs_info, space_info, &ticket);
 	spin_lock(&space_info->lock);
 	if (ticket.bytes) {
-		if (ticket.bytes < orig_bytes)
-			reclaim_bytes = orig_bytes - ticket.bytes;
 		list_del_init(&ticket.list);
 		ret = -ENOSPC;
 	}
 	spin_unlock(&space_info->lock);
-
-	if (reclaim_bytes)
-		btrfs_space_info_add_old_bytes(fs_info, space_info,
-					       reclaim_bytes);
 	ASSERT(list_empty(&ticket.list));
 	return ret;
 }
diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
index 9ae5cae52fde..ebc5b407a954 100644
--- a/fs/btrfs/space-info.h
+++ b/fs/btrfs/space-info.h
@@ -70,7 +70,6 @@  struct btrfs_space_info {
 };
 
 struct reserve_ticket {
-	u64 orig_bytes;
 	u64 bytes;
 	int error;
 	struct list_head list;