From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH v3 5/5] btrfs: cleanup device states define BTRFS_DEV_STATE_FLUSH_SENT
Date: Sun, 10 Dec 2017 17:15:22 +0800 [thread overview]
Message-ID: <20171210091522.6061-6-anand.jain@oracle.com> (raw)
In-Reply-To: <20171210091522.6061-1-anand.jain@oracle.com>
Currently device state is being managed by each individual int
variable such as struct btrfs_device::is_tgtdev_for_dev_replace.
Instead of that declare btrfs_device::dev_state
BTRFS_DEV_STATE_FLUSH_SENT and use the bit operations.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v3: Define BTRFS_DEV_STATE_FLUSH_SENT as bit nr
fs/btrfs/disk-io.c | 6 +++---
fs/btrfs/volumes.h | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 890e3a6a2f3e..9b20c1f3563b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3359,7 +3359,7 @@ static void write_dev_flush(struct btrfs_device *device)
bio->bi_private = &device->flush_wait;
btrfsic_submit_bio(bio);
- device->flush_bio_sent = 1;
+ set_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
}
/*
@@ -3369,10 +3369,10 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
{
struct bio *bio = device->flush_bio;
- if (!device->flush_bio_sent)
+ if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state))
return BLK_STS_OK;
- device->flush_bio_sent = 0;
+ clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
wait_for_completion_io(&device->flush_wait);
return bio->bi_status;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index a15f8b103072..826fce3d6825 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -51,6 +51,7 @@ struct btrfs_pending_bios {
#define BTRFS_DEV_STATE_IN_FS_METADATA 1
#define BTRFS_DEV_STATE_MISSING 2
#define BTRFS_DEV_STATE_REPLACE_TGT 3
+#define BTRFS_DEV_STATE_FLUSH_SENT 4
struct btrfs_device {
struct list_head dev_list;
--
2.7.0
next prev parent reply other threads:[~2017-12-10 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-10 9:15 [PATCH v3 0/5] define BTRFS_DEV_STATE Anand Jain
2017-12-10 9:15 ` [PATCH v3 1/5] btrfs: cleanup device states define BTRFS_DEV_STATE_WRITEABLE Anand Jain
2017-12-10 9:15 ` [PATCH v3 2/5] btrfs: cleanup device states define BTRFS_DEV_STATE_IN_FS_METADATA Anand Jain
2017-12-10 9:15 ` [PATCH v3 3/5] btrfs: cleanup device states define BTRFS_DEV_STATE_MISSING Anand Jain
2017-12-10 9:15 ` [PATCH v3 4/5] btrfs: cleanup device states define BTRFS_DEV_STATE_REPLACE_TGT Anand Jain
2017-12-10 9:15 ` Anand Jain [this message]
2017-12-12 17:42 ` [PATCH v3 0/5] define BTRFS_DEV_STATE David Sterba
2017-12-12 22:38 ` Anand Jain
2017-12-13 2:26 ` David Sterba
2017-12-13 9:57 ` Timofey Titovets
2017-12-13 18:44 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171210091522.6061-6-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).