Subject: Re: [take8 1/2] kevent: Core files.

From: Jeff Carr <[email-masked]>
Date: Sat, 12 Aug 2006 17:51:41 -0700

On 08/11/06 01:40, Evgeniy Polyakov wrote:

> +/*
> + * Inode events.
> + */
> +#define	KEVENT_INODE_CREATE	0x1
> +#define	KEVENT_INODE_REMOVE	0x2

It would be useful to have gnome/kde notification when hard drives start
failing. There was some talk in the past about how to implement that
with kobjects. Perhaps you could add for this purpose:

#define	KEVENT_BLOCK_CREATE	0x1
#define	KEVENT_BLOCK_REMOVE	0x2
#define	KEVENT_BLOCK_ERROR	0x4

AFAICT:
The conversation concluded this is the best way to handle ioerrors:

--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -108,6 +108,8 @@ static void buffer_io_error(struct buffe
 	printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
 			bdevname(bh->b_bdev, b),
 			(unsigned long long)bh->b_blocknr);
+
+	kevent_block_error(&bh->b_bdev->bd_disk->kobj);
 }

 /*
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -252,8 +252,11 @@ static void finished_one_bio(struct dio
 				transferred = dio->i_size - offset;

 			/* check for error in completion path */
-			if (dio->io_error)
+			if (dio->io_error) {
 				transferred = dio->io_error;
+				kevent_block_error(
+				&dio->bio->bi_bdev->bd_disk->kobj);
+			}

 			dio_complete(dio, offset, transferred);