From: Andy Grover <agrover@redhat.com>
To: dm-devel@redhat.com
Subject: [PATCH 4/5] dm: Add uevent support for dm-thin
Date: Wed, 16 Mar 2016 16:27:46 -0700 [thread overview]
Message-ID: <1458170867-429-5-git-send-email-agrover@redhat.com> (raw)
In-Reply-To: <1458170867-429-1-git-send-email-agrover@redhat.com>
Create a uevent before calling dm_table_event() when either data or
metadata low water are hit, as well as when pool mode changes.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
drivers/md/dm-thin.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 92237b6..b9fa18f 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -7,6 +7,7 @@
#include "dm-thin-metadata.h"
#include "dm-bio-prison.h"
#include "dm.h"
+#include "dm-uevent.h"
#include <linux/device-mapper.h>
#include <linux/dm-io.h>
@@ -1345,6 +1346,20 @@ static int commit(struct pool *pool)
return r;
}
+static void add_thin_uevent(struct dm_target *ti, char *name)
+{
+ struct mapped_device *md = dm_table_get_md(ti->table);
+ struct dm_uevent *event;
+
+ event = dm_build_uevent(md, ti, KOBJ_CHANGE, name);
+ if (IS_ERR(event)) {
+ DMERR("%s: dm_build_uevent() failed", __func__);
+ return;
+ }
+
+ dm_uevent_add(md, &event->elist);
+}
+
static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks)
{
unsigned long flags;
@@ -1355,6 +1370,7 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks)
spin_lock_irqsave(&pool->lock, flags);
pool->low_water_triggered = true;
spin_unlock_irqrestore(&pool->lock, flags);
+ add_thin_uevent(pool->ti, "THIN_LOW_WATER_DATA");
dm_table_event(pool->ti->table);
}
}
@@ -2331,6 +2347,7 @@ static enum pool_mode get_pool_mode(struct pool *pool)
static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode)
{
+ add_thin_uevent(pool->ti, "THIN_POOL_MODE");
dm_table_event(pool->ti->table);
DMINFO("%s: switching pool to %s mode",
dm_device_name(pool->pool_md), new_mode);
@@ -3026,6 +3043,7 @@ static void metadata_low_callback(void *context)
DMWARN("%s: reached low water mark for metadata device: sending event.",
dm_device_name(pool->pool_md));
+ add_thin_uevent(pool->ti, "THIN_LOW_WATER_METADATA");
dm_table_event(pool->ti->table);
}
--
2.5.0
next prev parent reply other threads:[~2016-03-16 23:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 23:27 [PATCH 0/5] Use uevent for thin pool events Andy Grover
2016-03-16 23:27 ` [PATCH 1/5] dm: Do not export dm_send_uevents Andy Grover
2016-03-16 23:27 ` [PATCH 2/5] dm: Move multipath-specific stuff out of dm-uevent.c Andy Grover
2016-03-16 23:27 ` [PATCH 3/5] dm: Inline dm_build_path_uevent into dm_path_uevent Andy Grover
2016-03-16 23:27 ` Andy Grover [this message]
2016-03-16 23:27 ` [PATCH 5/5] dm: Update dm-uevent.txt Andy Grover
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=1458170867-429-5-git-send-email-agrover@redhat.com \
--to=agrover@redhat.com \
--cc=dm-devel@redhat.com \
/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).