|
From: Laurence L. <la...@us...> - 2007-06-11 05:08:55
|
Update of /cvsroot/xbox-linux/kernel-2.6/fs/partitions In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5497/fs/partitions Modified Files: Kconfig check.c Log Message: Merge 2.6.20 Index: Kconfig =================================================================== RCS file: /cvsroot/xbox-linux/kernel-2.6/fs/partitions/Kconfig,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Kconfig 11 Jun 2007 05:06:13 -0000 1.13 +++ Kconfig 11 Jun 2007 05:08:52 -0000 1.14 @@ -194,7 +194,7 @@ config SGI_PARTITION bool "SGI partition support" if PARTITION_ADVANCED - default y if (SGI_IP22 || SGI_IP27 || ((MACH_JAZZ || SNI_RM200_PCI) && !CPU_LITTLE_ENDIAN)) + default y if (SGI_IP22 || SGI_IP27 || ((MACH_JAZZ || SNI_RM) && !CPU_LITTLE_ENDIAN)) help Say Y here if you would like to be able to read the hard disk partition table format used by SGI machines. Index: check.c =================================================================== RCS file: /cvsroot/xbox-linux/kernel-2.6/fs/partitions/check.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- check.c 11 Jun 2007 05:07:36 -0000 1.18 +++ check.c 11 Jun 2007 05:08:52 -0000 1.19 @@ -154,7 +154,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev) { struct parsed_partitions *state; - int i, res; + int i, res, err; state = kmalloc(sizeof(struct parsed_partitions), GFP_KERNEL); if (!state) @@ -166,10 +166,17 @@ sprintf(state->name, "p"); state->limit = hd->minors; - i = res = 0; + i = res = err = 0; while (!res && check_part[i]) { memset(&state->parts, 0, sizeof(state->parts)); res = check_part[i++](state, bdev); + if (res < 0) { + /* We have hit an I/O error which we don't report now. + * But record it, and let the others do their job. + */ + err = res; + res = 0; + } } #ifdef CONFIG_XBOX_PARTITION { @@ -181,12 +188,15 @@ #endif if (res > 0) return state; + if (!err) + /* The partition is unrecognized. So report I/O errors if there were any */ + res = err; if (!res) printk(" unknown partition table\n"); else if (warn_no_part) printk(" unable to read partition table\n"); kfree(state); - return NULL; + return ERR_PTR(res); } /* @@ -274,12 +284,39 @@ .show = part_stat_read }; +#ifdef CONFIG_FAIL_MAKE_REQUEST + +static ssize_t part_fail_store(struct hd_struct * p, + const char *buf, size_t count) +{ + int i; + + if (count > 0 && sscanf(buf, "%d", &i) > 0) + p->make_it_fail = (i == 0) ? 0 : 1; + + return count; +} +static ssize_t part_fail_read(struct hd_struct * p, char *page) +{ + return sprintf(page, "%d\n", p->make_it_fail); +} +static struct part_attribute part_attr_fail = { + .attr = {.name = "make-it-fail", .mode = S_IRUGO | S_IWUSR }, + .store = part_fail_store, + .show = part_fail_read +}; + +#endif + static struct attribute * default_attrs[] = { &part_attr_uevent.attr, &part_attr_dev.attr, &part_attr_start.attr, &part_attr_size.attr, &part_attr_stat.attr, +#ifdef CONFIG_FAIL_MAKE_REQUEST + &part_attr_fail.attr, +#endif NULL, }; @@ -503,6 +540,8 @@ disk->fops->revalidate_disk(disk); if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) return 0; + if (IS_ERR(state)) /* I/O error reading the partition table */ + return PTR_ERR(state); for (p = 1; p < state->limit; p++) { sector_t size = state->parts[p].size; sector_t from = state->parts[p].from; |