Download presentation
Presentation is loading. Please wait.
Published byReynold Phelps Modified over 9 years ago
1
Presenter : kilroy 1
2
Introduction Experiment 1 - Simulate a virtual disk device Experiment 2 - Nand-flash simulation for wear leveling algo. Conclusion 2
3
What those experiments Why those experiments Welcome our new machine Main object 3
4
What to do Simulate a disk device How to do Using a block device driver Object Understanding more about device drivers 4
5
5
6
Quick function Reference #include int register_blkdev(unsigned int major, const char *name); int unregister_blkdev(unsigned int major, const char *name); struct block_device_operations #include struct gendisk *alloc_disk(int minors); void add_disk(struct gendisk *gd); void set_capacity(struct gendisk *gd, sector_t sectors); void add_disk(struct gendisk *gd); 6
7
#include request_queue_t blk_init_queue(request_fn_proc *request, spinlock_t *lock); struct request *elv_next_request(request_queue_t *queue); void end_request(struct request *req, int success); #include void *vmalloc(unsigned long size); 7
8
Structure block_device_operations in 8
9
Implement function what we need: sbull_init() sbull_exit() sbull_open() sbull_release() sbull_request() sbull_transfer() 9
10
Nand-falsh simulation Simulate a nand type flash in memory Design an experiment that observing the wear leveling erase count Two parts, one for ext2 one for jffs2 Two steps Understanding the way of erasing Experiment Environment 64MB nand type flash 512B page size 10
11
Step 1: Trace code.. At..linux/drivers/mtd/nand nand_base.c is the key Function nand_erase_nand 11
12
Function nand_erase_nand 1.check if address align on block bounday 2.check if length align on block bounday 3.check the erase will pass the end of device 4.shift to get first page 5.calculate pages in each block 6.check if write protected 7.check whether refresh BBT 8.erase operation (page by page) -check if have bad block -Invalidate the page cache -see if operation failed and additional status checks are available -see if block erase succeeded -check if cross a chip boundary 12
13
Step 2: Experiment design Observe form kernel debug message Using nandsim to simulate Counting & ploting 13
14
Experiment 2 result 14
15
Experiment 2 result 15
16
Working log will be your good friend Good habit Bug & balk record Share your problem & result to others Keep your schedule in mind Experience form experiment
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.