* [PATCH] btrfs: drop btrfs_device::can_discard to query directly
@ 2017-11-29 10:53 Anand Jain
2017-11-29 11:53 ` Nikolay Borisov
0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2017-11-29 10:53 UTC (permalink / raw)
To: linux-btrfs; +Cc: nborisov
We can query the bdev directly when needed at btrfs_discard_extent()
so drop btrfs_device::can_discard.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Suggested-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/extent-tree.c | 5 ++++-
fs/btrfs/volumes.c | 8 --------
fs/btrfs/volumes.h | 1 -
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 85a545cf4395..830666c95360 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2145,7 +2145,10 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
for (i = 0; i < bbio->num_stripes; i++, stripe++) {
u64 bytes;
- if (!stripe->dev->can_discard)
+ struct request_queue *req_q;
+
+ req_q = bdev_get_queue(stripe->dev->bdev);
+ if (!blk_queue_discard(req_q))
continue;
ret = btrfs_issue_discard(stripe->dev->bdev,
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ff62919d568f..ff52ecf17402 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -630,8 +630,6 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
}
q = bdev_get_queue(bdev);
- if (blk_queue_discard(q))
- device->can_discard = 1;
if (!blk_queue_nonrot(q))
fs_devices->rotating = 1;
@@ -2387,8 +2385,6 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
}
q = bdev_get_queue(bdev);
- if (blk_queue_discard(q))
- device->can_discard = 1;
set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
device->generation = trans->transid;
device->io_width = fs_info->sectorsize;
@@ -2539,7 +2535,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
struct btrfs_device *srcdev,
struct btrfs_device **device_out)
{
- struct request_queue *q;
struct btrfs_device *device;
struct block_device *bdev;
struct list_head *devices;
@@ -2596,9 +2591,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
}
rcu_assign_pointer(device->name, name);
- q = bdev_get_queue(bdev);
- if (blk_queue_discard(q))
- device->can_discard = 1;
mutex_lock(&fs_info->fs_devices->device_list_mutex);
set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
device->generation = 0;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 2fbff6902c8d..1cc693716b9a 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -74,7 +74,6 @@ struct btrfs_device {
fmode_t mode;
unsigned long dev_state;
- int can_discard;
int is_tgtdev_for_dev_replace;
blk_status_t last_flush_error;
int flush_bio_sent;
--
2.15.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: drop btrfs_device::can_discard to query directly
2017-11-29 10:53 [PATCH] btrfs: drop btrfs_device::can_discard to query directly Anand Jain
@ 2017-11-29 11:53 ` Nikolay Borisov
2017-11-30 17:32 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2017-11-29 11:53 UTC (permalink / raw)
To: Anand Jain, linux-btrfs
On 29.11.2017 12:53, Anand Jain wrote:
> We can query the bdev directly when needed at btrfs_discard_extent()
> so drop btrfs_device::can_discard.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> Suggested-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent-tree.c | 5 ++++-
> fs/btrfs/volumes.c | 8 --------
> fs/btrfs/volumes.h | 1 -
> 3 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 85a545cf4395..830666c95360 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2145,7 +2145,10 @@ int btrfs_discard_extent(struct btrfs_fs_info *fs_info, u64 bytenr,
>
> for (i = 0; i < bbio->num_stripes; i++, stripe++) {
> u64 bytes;
> - if (!stripe->dev->can_discard)
> + struct request_queue *req_q;
> +
> + req_q = bdev_get_queue(stripe->dev->bdev);
> + if (!blk_queue_discard(req_q))
> continue;
>
> ret = btrfs_issue_discard(stripe->dev->bdev,
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index ff62919d568f..ff52ecf17402 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -630,8 +630,6 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
> }
>
> q = bdev_get_queue(bdev);
> - if (blk_queue_discard(q))
> - device->can_discard = 1;
> if (!blk_queue_nonrot(q))
> fs_devices->rotating = 1;
>
> @@ -2387,8 +2385,6 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
> }
>
> q = bdev_get_queue(bdev);
> - if (blk_queue_discard(q))
> - device->can_discard = 1;
> set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
> device->generation = trans->transid;
> device->io_width = fs_info->sectorsize;
> @@ -2539,7 +2535,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> struct btrfs_device *srcdev,
> struct btrfs_device **device_out)
> {
> - struct request_queue *q;
> struct btrfs_device *device;
> struct block_device *bdev;
> struct list_head *devices;
> @@ -2596,9 +2591,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> }
> rcu_assign_pointer(device->name, name);
>
> - q = bdev_get_queue(bdev);
> - if (blk_queue_discard(q))
> - device->can_discard = 1;
> mutex_lock(&fs_info->fs_devices->device_list_mutex);
> set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
> device->generation = 0;
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 2fbff6902c8d..1cc693716b9a 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -74,7 +74,6 @@ struct btrfs_device {
> fmode_t mode;
>
> unsigned long dev_state;
> - int can_discard;
> int is_tgtdev_for_dev_replace;
> blk_status_t last_flush_error;
> int flush_bio_sent;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: drop btrfs_device::can_discard to query directly
2017-11-29 11:53 ` Nikolay Borisov
@ 2017-11-30 17:32 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2017-11-30 17:32 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: Anand Jain, linux-btrfs
On Wed, Nov 29, 2017 at 01:53:29PM +0200, Nikolay Borisov wrote:
>
>
> On 29.11.2017 12:53, Anand Jain wrote:
> > We can query the bdev directly when needed at btrfs_discard_extent()
> > so drop btrfs_device::can_discard.
> >
> > Signed-off-by: Anand Jain <anand.jain@oracle.com>
> > Suggested-by: Nikolay Borisov <nborisov@suse.com>
>
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Added to next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-30 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 10:53 [PATCH] btrfs: drop btrfs_device::can_discard to query directly Anand Jain
2017-11-29 11:53 ` Nikolay Borisov
2017-11-30 17:32 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.