Codebase list libatasmart / 27c81f1
Add 0002-Drop-our-own-many-bad-sectors-heuristic.patch: Drop our own "many bad sectors" heuristic.This currently causes a lot of false positives, because in many cases our treshold is either overly pessimistically low, or the raw value is implausibly high. Just use the normalized values vs. treshold for now. (LP: #438136, fd.o #25772) Martin Pitt 14 years ago
3 changed file(s) with 101 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
22 * debian/local/apport-hook.py: Update for udisks.
33 * Add 0001-Speed-up-get_overall-and-get_bad.patch: Speed up get_overall()
44 and get_bad(). (fd.o #26834)
5 * Add 0002-Drop-our-own-many-bad-sectors-heuristic.patch: Drop our own "many
6 bad sectors" heuristic.This currently causes a lot of false positives,
7 because in many cases our treshold is either overly pessimistically low,
8 or the raw value is implausibly high. Just use the normalized values vs.
9 treshold for now. (LP: #438136, fd.o #25772)
510
611 -- Martin Pitt <mpitt@debian.org> Tue, 16 Mar 2010 17:11:55 +0100
712
0 From 6846b7c2431dbeaddd9f931c609b522c04e55732 Mon Sep 17 00:00:00 2001
1 From: Martin Pitt <martin.pitt@ubuntu.com>
2 Date: Fri, 19 Mar 2010 14:56:06 +0100
3 Subject: [PATCH 2/2] Drop our own "many bad sectors" heuristic
4
5 This currently causes a lot of false positives, because in many cases our
6 treshold is either overly pessimistically low, or the raw value is implausibly
7 high. Just use the normalized values vs. treshold for now.
8
9 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=25772
10 Bug-Ubuntu: https://launchpad.net/bugs/438136
11 ---
12 atasmart.c | 33 +++++++++++----------------------
13 1 files changed, 11 insertions(+), 22 deletions(-)
14
15 diff --git a/atasmart.c b/atasmart.c
16 index 13d55ff..beb57b2 100644
17 --- a/atasmart.c
18 +++ b/atasmart.c
19 @@ -130,6 +130,8 @@ struct SkDisk {
20 SkBool current_pending_sector_found:1;
21 uint64_t reallocated_sector_count;
22 uint64_t current_pending_sector;
23 + SkBool reallocated_sector_count_bad:1;
24 + SkBool current_pending_sector_bad:1;
25
26 void *blob;
27 };
28 @@ -2037,16 +2039,23 @@ static void fill_cache_cb(SkDisk *d, const SkSmartAttributeParsedData *a, void*
29 if (a->pretty_unit != SK_SMART_ATTRIBUTE_UNIT_SECTORS)
30 return;
31
32 + if (!a->current_value_valid)
33 + return;
34 +
35 if (!strcmp(a->name, "reallocated-sector-count")) {
36 if (a->pretty_value > d->reallocated_sector_count)
37 d->reallocated_sector_count = a->pretty_value;
38 d->reallocated_sector_count_found = TRUE;
39 + if (a->good_now_valid && !a->good_now)
40 + d->reallocated_sector_count_bad = TRUE;
41 }
42
43 if (!strcmp(a->name, "current-pending-sector")) {
44 if (a->pretty_value > d->current_pending_sector)
45 d->current_pending_sector = a->pretty_value;
46 d->current_pending_sector_found = TRUE;
47 + if (a->good_now_valid && !a->good_now)
48 + d->current_pending_sector_bad = TRUE;
49 }
50 }
51
52 @@ -2102,24 +2111,9 @@ const char* sk_smart_overall_to_string(SkSmartOverall overall) {
53 return _P(map[overall]);
54 }
55
56 -static uint64_t u64log2(uint64_t n) {
57 - unsigned r;
58 -
59 - if (n <= 1)
60 - return 0;
61 -
62 - r = 0;
63 - for (;;) {
64 - n = n >> 1;
65 - if (!n)
66 - return r;
67 - r++;
68 - }
69 -}
70 -
71 int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) {
72 SkBool good;
73 - uint64_t sectors, sector_threshold;
74 + uint64_t sectors;
75
76 assert(d);
77 assert(overall);
78 @@ -2140,12 +2134,7 @@ int sk_disk_smart_get_overall(SkDisk *d, SkSmartOverall *overall) {
79 return -1;
80 sectors = 0;
81 } else {
82 -
83 - /* We use log2(n_sectors) as a threshold here. We had to pick
84 - * something, and this makes a bit of sense, or doesn't it? */
85 - sector_threshold = u64log2(d->size/512);
86 -
87 - if (sectors >= sector_threshold) {
88 + if (d->reallocated_sector_count_bad || d->current_pending_sector_bad) {
89 *overall = SK_SMART_OVERALL_BAD_SECTOR_MANY;
90 return 0;
91 }
92 --
93 1.7.0
94
00 # Debian patches for libatasmart
11 0001-Speed-up-get_overall-and-get_bad.patch
2 0002-Drop-our-own-many-bad-sectors-heuristic.patch