FS support for grant-based i/o.

For character device i/o, FS does a so-called 'magic' grant to let the
driver copy from or to user space. As this is done in FS address space,
the driver is told to do this in FS address space. The redirection to
the right user process then happens at copy-time in the kernel, using the
FS grant table. This also happens for DEV_READ and DEV_WRITE on block
devices.

For other block device i/o, which happens from/to FS buffers, FS does
a 'direct' grant to its own address space for the driver.

After the i/o returns, this access has to be K-I-L-L-E-D, revoked.
Sometimes this is after a SUSPEND and DEV_REVIVE, in which case the
revoking happens in pipe.c.

This conversion happens in safe_io_conversion() in device.c, called
by dev_io and dev_bio.

FS has to pre-allocate its own space for these grant tables. This happens
in main.c.
This commit is contained in:
Ben Gras
2006-06-20 10:12:09 +00:00
parent 54f1e6d3d4
commit 2384a85296
8 changed files with 307 additions and 61 deletions

View File

@@ -70,6 +70,7 @@ int only_search; /* if NO_READ, don't read, else act normal */
/* This block is not the one sought. */
bp = bp->b_hash; /* move to next block on hash chain */
}
}
}
@@ -272,7 +273,7 @@ int rw_flag; /* READING or WRITING */
if ( (dev = bp->b_dev) != NO_DEV) {
pos = (off_t) bp->b_blocknr * block_size;
op = (rw_flag == READING ? DEV_READ : DEV_WRITE);
r = dev_bio(op, dev, FS_PROC_NR, bp->b_data, pos, block_size, 0);
r = dev_bio(op, dev, FS_PROC_NR, bp->b_data, pos, block_size);
if (r != block_size) {
if (r >= 0) r = END_OF_FILE;
if (r != END_OF_FILE)
@@ -376,7 +377,7 @@ int rw_flag; /* READING or WRITING */
}
r = dev_bio(rw_flag == WRITING ? DEV_SCATTER : DEV_GATHER,
dev, FS_PROC_NR, iovec,
(off_t) bufq[0]->b_blocknr * block_size, j, 0);
(off_t) bufq[0]->b_blocknr * block_size, j);
/* Harvest the results. Dev_io reports the first error it may have
* encountered, but we only care if it's the first block that failed.