[lkml]   [2001]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [CFT][PATCH] cleanup of partition code

In the IA-64 port lives the EFI GUID Partition Table (GPT) partitioning
code. It's not yet merged into the mainline kernel tree. I've made a
first-stab at a patch to make the GPT code use the page cache, and I'd
appreciate you taking a look.

Start with 2.4.10
apply 2.4.11-pre1
apply your latest partition patch (partition-d-S11-pre1 I think)
apply latest ia64 patch
(there's one rejection in include/linux/genhd.h that's easy to fix)

The GPT code is in fs/partition/efi.[ch]. I'm concerned about reading a
page or partial page at the end of a disk, particularly an odd-sized disk.
In the pagecache patch I remove the set_blocksize() stuff, as it's not clear
if it's still needed, or if a disk with sectors % PAGE_CACHE_SIZE != 0 can
even read those last sectors.

Reading even the first few sectors fails with these patches, where if I
remove your partition patch and my pagecache patch, it works fine. I'm
certain it's a bug in my read_lba() code, which could use to be optimized

static size_t
read_lba(struct gendisk *hd, struct block_device *bdev, u64 lba, u8 *buffer,
size_t count)

size_t totalreadcount = 0, bytesread;
int i, blockstoread, blocksize;
Sect sect;
unsigned char *data=NULL;

if (!hd || !buffer || !count) return 0;

blocksize = get_hardsect_size(to_kdev_t(bdev->bd_dev));
blockstoread = count / blocksize;
if (count % blocksize) blockstoread += 1;
for (i=0; i<blockstoread; i++) {
data = read_dev_sector(bdev, lba, &sect);
if (!data) {
return totalreadcount;

bytesread = (count > 512 ? 512 : count);
memcpy(buffer, data, bytesread);

buffer += bytesread; /* Advance the buffer pointer
totalreadcount += bytesread; /* Advance the total read count
count -= bytesread; /* Subtract bytesread from count

return totalreadcount;

I'd appreciate your pointers.


Matt Domsch
Sr. Software Engineer
Dell Linux Solutions
#2 Linux Server provider with 17% in the US and 14% Worldwide (IDC)!
#3 Unix provider with 18% in the US (Dataquest)!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:03    [W:0.019 / U:6.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site