From: Andrew Morton <akpm@linux-foundation.org>
To: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: axboe@kernel.dk, hirofumi@mail.parknet.co.jp,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, adrian.hunter@nokia.com,
artem.bityutskiy@nokia.com
Subject: Re: [PATCH 1/4] FS: filesystem corruption notification
Date: Wed, 3 Jun 2009 11:58:10 -0700 [thread overview]
Message-ID: <20090603115810.10641330.akpm@linux-foundation.org> (raw)
In-Reply-To: <e7005f79dd6b8f25fef78ddbfedcef54f6b40bd5.1244049680.git.ext-denis.2.karpov@nokia.com>
On Wed, 3 Jun 2009 18:05:15 +0300
Denis Karpov <ext-denis.2.karpov@nokia.com> wrote:
> Add a generic mechnism to notify the userspace about possible filesystem
> corruption through sysfs entry (/sys/block/<bdev>/<part>/fs_unclean)
> and uevent (KOBJ_CHANGE, uevent's environment variable FS_UNCLEAN=[0:1]).
>
> To mark fs clean (e.g. after fs was fixed by userspace):
>
> echo 0 > /sys/block/<bdev>/<part>/fs_unclean
> (you will still receive uevent KOBJ_CHANGE with env var FS_UNCLEAN=0)
>
> Signed-off-by: Denis Karpov <ext-denis.2.karpov@nokia.com>
> ---
> fs/partitions/check.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/genhd.h | 2 ++
> 2 files changed, 44 insertions(+), 0 deletions(-)
>
> diff --git a/fs/partitions/check.c b/fs/partitions/check.c
> index 99e33ef..191d89e 100644
> --- a/fs/partitions/check.c
> +++ b/fs/partitions/check.c
> @@ -196,6 +196,24 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
> return ERR_PTR(res);
> }
>
> +void notify_part_fs_unclean(struct device *dev, uint8_t unclean)
> +{
> + char event_string[13];
> + char *envp[] = { event_string, NULL };
> +
> + if ((unclean != 0 && unclean != 1) ||
> + unclean == dev_to_part(dev)->fs_unclean)
> + return;
> +
> + dev_to_part(dev)->fs_unclean = unclean;
> +
> + sysfs_notify(&dev->kobj, NULL, "fs_unclean");
> +
> + sprintf(event_string, "FS_UNCLEAN=%u", unclean);
> + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
> +}
> +EXPORT_SYMBOL(notify_part_fs_unclean);
Please document this function.
That documentation should, amongst other things, explain the semantics
of the `unclean' argument. It can be 0, 1 or "something else". Why?
Also, why is `unclean' a u8 rather than a boring old `int'?
> static ssize_t part_partition_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> @@ -246,6 +264,26 @@ ssize_t part_stat_show(struct device *dev,
> jiffies_to_msecs(part_stat_read(p, time_in_queue)));
> }
>
> +ssize_t part_fs_unclean_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct hd_struct *p = dev_to_part(dev);
> +
> + return sprintf(buf, "%d\n", p->fs_unclean);
> +}
> +
> +ssize_t part_fs_unclean_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + int i;
> +
> + if (count > 0 && sscanf(buf, "%d", &i) > 0)
strict_strtoul(), please.
> + notify_part_fs_unclean(dev, (i == 0) ? 0 : 1);
> +
> + return count;
> +}
next prev parent reply other threads:[~2009-06-03 18:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 15:05 [PATCH 0/4] FS: userspace notification of errors Denis Karpov
2009-06-03 15:05 ` [PATCH 1/4] FS: filesystem corruption notification Denis Karpov
2009-06-03 15:05 ` [PATCH 2/4] FAT: generalize errors and warning printing Denis Karpov
2009-06-03 15:05 ` [PATCH 3/4] FAT: add 'notify' mount option Denis Karpov
2009-06-03 15:05 ` [PATCH 4/4] EXT2: " Denis Karpov
2009-06-03 19:00 ` Andrew Morton
2009-06-10 21:03 ` Pavel Machek
2009-06-03 18:59 ` [PATCH 3/4] FAT: " Andrew Morton
2009-06-03 18:58 ` Andrew Morton [this message]
2009-06-03 15:36 ` [PATCH 0/4] FS: userspace notification of errors Eric Sandeen
2009-06-03 18:56 ` Andrew Morton
2009-06-04 1:59 ` Jamie Lokier
2009-06-04 5:57 ` Artem Bityutskiy
2009-06-04 14:27 ` Denis Karpov
2009-06-10 21:05 ` Pavel Machek
2009-06-04 12:53 ` Kay Sievers
2009-06-04 14:29 ` Russell Cattelan
2009-06-05 7:25 ` Jon Masters
2009-06-05 11:07 ` Artem Bityutskiy
2009-06-05 11:51 ` Denis Karpov
2009-06-05 13:06 ` Kay Sievers
[not found] ` <ac3eb2510906050606u7527654dv789364549b36f3e7@mail.gmail.com>
2009-06-09 13:49 ` Jan Kara
2009-06-03 22:30 ` Jan Kara
2009-06-04 6:10 ` Artem Bityutskiy
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=20090603115810.10641330.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adrian.hunter@nokia.com \
--cc=artem.bityutskiy@nokia.com \
--cc=axboe@kernel.dk \
--cc=ext-denis.2.karpov@nokia.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).