diff options
author | Albert Lee <albertcc@tw.ibm.com> | 2005-10-12 03:12:26 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 17:18:16 -0400 |
commit | c6a33e2464edd87f8c12cc2d11369a5b44c65b77 (patch) | |
tree | f15eb374fa98fb1f76bf3a7cffd9cb8ef7173091 /include/linux/ata.h | |
parent | 59a10b172fccaea793352c00fd9065f0a5b4ef70 (diff) |
[PATCH] libata CHS: LBA28/LBA48 optimization (revise #6)
- add lba_28_ok() and lba_48_ok() to ata.h.
- check ending block number instead of staring block number.
- use lba_28_ok() for CHS range check
- LBA28/LBA48 optimization
Suggested by Mark Lord and Alan Cox.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
=====
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 630908c9378b..b7e7e1cb2633 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -291,4 +291,16 @@ static inline int ata_ok(u8 status) | |||
291 | == ATA_DRDY); | 291 | == ATA_DRDY); |
292 | } | 292 | } |
293 | 293 | ||
294 | static inline int lba_28_ok(u64 block, u32 n_block) | ||
295 | { | ||
296 | /* check the ending block number */ | ||
297 | return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); | ||
298 | } | ||
299 | |||
300 | static inline int lba_48_ok(u64 block, u32 n_block) | ||
301 | { | ||
302 | /* check the ending block number */ | ||
303 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | ||
304 | } | ||
305 | |||
294 | #endif /* __LINUX_ATA_H__ */ | 306 | #endif /* __LINUX_ATA_H__ */ |