| Function report | 
| Source Code: kernel\power\swap.c | Create Date:2022-07-28 10:02:42 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:save_image_lzo - Save the suspend image data compressed with LZO.*@handle: Swap map handle to use for saving the image.*@snapshot: Image to read data from.*@nr_to_write: Number of pages to save.
Proto:static int save_image_lzo(struct swap_map_handle *handle, struct snapshot_handle *snapshot, unsigned int nr_to_write)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct swap_map_handle * | handle | |
| struct snapshot_handle * | snapshot | |
| unsigned int | nr_to_write | 
| 671 | ret = 0 | 
| 679 | unsigned char * page = NULL | 
| 683 | hib_init_batch( & hb) | 
| 689 | nr_threads = num_online_cpus() - 1 | 
| 692 | page = __get_free_page(GFP_NOIO | __GFP_HIGH) | 
| 693 | If Not page Then | 
| 700 | If Not data Then | 
| 708 | crc = Allocation memory | 
| 709 | If Not crc Then | 
| 719 | When thr < nr_threads cycle | 
| 720 | init_waitqueue_head( & start compression ) | 
| 721 | init_waitqueue_head( & compression done ) | 
| 737 | init_waitqueue_head( & start crc update ) | 
| 738 | init_waitqueue_head( & crc update done ) | 
| 740 | crc32 = 0 | 
| 742 | When thr < nr_threads cycle | 
| 743 | uncompressed data [thr] = unc | 
| 759 | reqd_free_pages = Number of pages required to be kept free while writing the image. Always* half of all available low pages before the writing starts. | 
| 761 | pr_info("Using %u thread(s) for compression\n", nr_threads) | 
| 762 | pr_info("Compressing and saving image data (%u pages)...\n", nr_to_write) | 
| 764 | m = nr_to_write / 10 | 
| 767 | nr_pages = 0 | 
| 769 | cycle | 
| 770 | When thr < nr_threads cycle | 
| 771 | When off < LZO_UNC_SIZE cycle | 
| 773 | If ret < 0 Then Go to out_finish | 
| 776 | If Not ret Then Break | 
| 785 | nr_pages++ | 
| 787 | If Not off Then Break | 
| 790 | uncompressed length = off | 
| 792 | atomic_set( & ady to start flag , 1) | 
| 793 | wake_up( & start compression ) | 
| 796 | If Not thr Then Break | 
| 799 | r current threads = thr | 
| 800 | atomic_set( & ady to start flag , 1) | 
| 801 | wake_up( & start crc update ) | 
| 803 | When thr < run_threads cycle | 
| 806 | atomic_set( & ady to stop flag , 0) | 
| 810 | If ret < 0 Then | 
| 811 | pr_err("LZO compression failed\n") | 
| 812 | Go to out_finish | 
| 823 | cmp = compressed length | 
| 836 | No 3D Now!(page, cmp + off, PAGE_SIZE) | 
| 838 | ret = swap_write_page(handle, page, & hb) | 
| 839 | If ret Then Go to out_finish | 
| 845 | atomic_set( & ady to stop flag , 0) | 
| 848 | out_finish : | 
| 849 | err2 = hib_wait_io( & hb) | 
| 856 | out_clean : | 
| 857 | If crc Then | 
| 858 | If hread Then stop a thread | 
| 862 | If data Then | 
| 870 | Return ret | 
| Name | Describe | 
|---|---|
| swsusp_write | swsusp_write - Write entire image and metadata.*@flags: flags to pass to the "boot" kernel in the image header* It is important _NOT_ to umount filesystems at this point. We want* them synced (in case something goes wrong) but we DO not want to mark | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |