*参照元 [#h9002b8f] #backlinks *説明 [#k6178c22] -パス: [[linux-2.6.33/fs/direct-io.c]] -FIXME: これは何? --説明 **参考 [#u3541e5c] *実装 [#m5616caa] /* * This code generally works in units of "dio_blocks". A dio_block is * somewhere between the hard sector size and the filesystem block size. it * is determined on a per-invocation basis. When talking to the filesystem * we need to convert dio_blocks to fs_blocks by scaling the dio_block quantity * down by dio->blkfactor. Similarly, fs-blocksize quantities are converted * to bio_block quantities by shifting left by blkfactor. * * If blkfactor is zero then the user's request was aligned to the filesystem's * blocksize. */ struct dio { /* BIO submission state */ struct bio *bio; /* bio under assembly */ - --[[linux-2.6.33/bio]] struct inode *inode; - --[[linux-2.6.33/inode]] int rw; loff_t i_size; /* i_size when submitted */ - --[[linux-2.6.33/loff_t]] int flags; /* doesn't change */ unsigned blkbits; /* doesn't change */ unsigned blkfactor; /* When we're using an alignment which is finer than the filesystem's soft blocksize, this specifies how much finer. blkfactor=2 means 1/4-block alignment. Does not change */ unsigned start_zero_done; /* flag: sub-blocksize zeroing has been performed at the start of a write */ int pages_in_io; /* approximate total IO pages */ size_t size; /* total request size (doesn't change)*/ sector_t block_in_file; /* Current offset into the underlying file in dio_block units. */ - --[[linux-2.6.33/sector_t]] unsigned blocks_available; /* At block_in_file. changes */ sector_t final_block_in_request;/* doesn't change */ unsigned first_block_in_page; /* doesn't change, Used only once */ int boundary; /* prev block is at a boundary */ int reap_counter; /* rate limit reaping */ get_block_t *get_block; /* block mapping function */ - --[[linux-2.6.33/get_block_t]] dio_iodone_t *end_io; /* IO completion function */ - --[[linux-2.6.33/dio_inode_t]] sector_t final_block_in_bio; /* current final block in bio + 1 */ sector_t next_block_for_io; /* next block to be put under IO, in dio_blocks units */ struct buffer_head map_bh; /* last get_block() result */ - --[[linux-2.6.33/buffer_head]] /* * Deferred addition of a page to the dio. These variables are * private to dio_send_cur_page(), submit_page_section() and * dio_bio_add_page(). */ struct page *cur_page; /* The page */ - --[[linux-2.6.33/page]] unsigned cur_page_offset; /* Offset into it, in bytes */ unsigned cur_page_len; /* Nr of bytes at cur_page_offset */ sector_t cur_page_block; /* Where it starts */ /* BIO completion state */ spinlock_t bio_lock; /* protects BIO fields below */ - --[[linux-2.6.33/spinlock_t]] unsigned long refcount; /* direct_io_worker() and bios */ struct bio *bio_list; /* singly linked via bi_private */ - --[[linux-2.6.33/bio]] struct task_struct *waiter; /* waiting task (NULL if none) */ - --[[linux-2.6.33/task_struct]] /* AIO related stuff */ struct kiocb *iocb; /* kiocb */ - --[[linux-2.6.33/kiocb]] int is_async; /* is IO async ? */ int io_error; /* IO error in completion path */ ssize_t result; /* IO result */ /* * Page fetching state. These variables belong to dio_refill_pages(). */ int curr_page; /* changes */ int total_pages; /* doesn't change */ unsigned long curr_user_address;/* changes */ /* * Page queue. These variables belong to dio_refill_pages() and * dio_get_page(). */ unsigned head; /* next page to process */ unsigned tail; /* last valid page + 1 */ int page_errors; /* errno from get_user_pages() */ /* * pages[] (and any fields placed after it) are not zeroed out at * allocation time. Don't add new fields after pages[] unless you * wish that they not be zeroed. */ struct page *pages[DIO_PAGES]; /* page buffer */ - --[[linux-2.6.33/page]] }; *コメント [#o2b0a98c]