From 92ea0887accc95db7b8b95c6db5d0af5de207bec Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 10 Oct 2008 22:39:31 +0200 Subject: [PATCH] --- yaml --- r: 112895 b: refs/heads/master c: ff2779b568e70822e0ef2cc7afeeefbe7c607652 h: refs/heads/master i: 112893: 32ae105373259a1218bad63da921e86efcca8aae 112891: 5db3eb3833fef3799eb037fd2e71324b5e3b41ab 112887: 803649983626f64c1d78ee3bd6f7055ed6e6fea2 112879: c319575f61f510ed9a5f1f5666c4824cec99fb5d 112863: da76ba7f76e31e619dc39b81b644e0802d16b868 112831: 903181db29e2325ccb82245a5088cfc49464e5cc 112767: 78d2889797acfa67dfe287fff6ea12d95606e681 112639: 6447e5ac2a59007a7babd51b1271b0a4927ecb29 v: v3 --- [refs] | 2 +- trunk/drivers/ide/ide-disk.c | 6 +++--- trunk/drivers/ide/ide-io.c | 2 +- trunk/include/linux/ata.h | 13 +++++++++++++ trunk/include/linux/ide.h | 4 ---- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 5e83266dc9ea..8d3e6bd31066 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4b58f17d7c45a8e5f4acda641bec388398b9c0fa +refs/heads/master: ff2779b568e70822e0ef2cc7afeeefbe7c607652 diff --git a/trunk/drivers/ide/ide-disk.c b/trunk/drivers/ide/ide-disk.c index 7b24dff17460..587d5aac7d5d 100644 --- a/trunk/drivers/ide/ide-disk.c +++ b/trunk/drivers/ide/ide-disk.c @@ -576,7 +576,7 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) BUG_ON(task == NULL); memset(task, 0, sizeof(*task)); - if (ide_id_has_flush_cache_ext(drive->id) && + if (ata_id_flush_ext_enabled(drive->id) && (drive->capacity64 >= (1UL << 28))) task->tf.command = ATA_CMD_FLUSH_EXT; else @@ -653,7 +653,7 @@ static void update_ordered(ide_drive_t *drive) capacity = idedisk_capacity(drive); barrier = ata_id_flush_enabled(id) && !drive->noflush && (drive->addressing == 0 || capacity <= (1ULL << 28) || - ide_id_has_flush_cache_ext(id)); + ata_id_flush_ext_enabled(id)); printk(KERN_INFO "%s: cache flushes %ssupported\n", drive->name, barrier ? "" : "not "); @@ -699,7 +699,7 @@ static int do_idedisk_flushcache(ide_drive_t *drive) ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); - if (ide_id_has_flush_cache_ext(drive->id)) + if (ata_id_flush_ext_enabled(drive->id)) args.tf.command = ATA_CMD_FLUSH_EXT; else args.tf.command = ATA_CMD_FLUSH; diff --git a/trunk/drivers/ide/ide-io.c b/trunk/drivers/ide/ide-io.c index c1596178fcae..ec6664b0d3a9 100644 --- a/trunk/drivers/ide/ide-io.c +++ b/trunk/drivers/ide/ide-io.c @@ -188,7 +188,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * ide_complete_power_step(drive, rq, 0, 0); return ide_stopped; } - if (ide_id_has_flush_cache_ext(drive->id)) + if (ata_id_flush_ext_enabled(drive->id)) args->tf.command = ATA_CMD_FLUSH_EXT; else args->tf.command = ATA_CMD_FLUSH; diff --git a/trunk/include/linux/ata.h b/trunk/include/linux/ata.h index 921cf0fc337f..81d9adeb819e 100644 --- a/trunk/include/linux/ata.h +++ b/trunk/include/linux/ata.h @@ -574,6 +574,19 @@ static inline int ata_id_has_flush_ext(const u16 *id) return id[ATA_ID_COMMAND_SET_2] & (1 << 13); } +static inline int ata_id_flush_ext_enabled(const u16 *id) +{ + if (ata_id_has_flush_ext(id) == 0) + return 0; + if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) + return 0; + /* + * some Maxtor disks have bit 13 defined incorrectly + * so check bit 10 too + */ + return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; +} + static inline int ata_id_has_lba48(const u16 *id) { if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) diff --git a/trunk/include/linux/ide.h b/trunk/include/linux/ide.h index d2213d7cc4cb..432eb98f7fe7 100644 --- a/trunk/include/linux/ide.h +++ b/trunk/include/linux/ide.h @@ -1453,10 +1453,6 @@ extern struct mutex ide_cfg_mtx; extern struct bus_type ide_bus_type; extern struct class *ide_port_class; -/* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ -#define ide_id_has_flush_cache_ext(id) \ - (((id)[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400) - static inline void ide_dump_identify(u8 *id) { print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);