Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\zswap.c Create Date:2022-07-28 15:23:04
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:zswap_writeback_entry

Proto:static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)

Type:int

Parameter:

TypeParameterName
struct zpool *pool
unsigned longhandle
852  struct writeback_control wbc = {sync_mode = WB_SYNC_NONE, }
857  zhdr = zpool_map_handle(pool, handle, ad-only (no copy-out at unmap time) )
858  swpentry = swpentry
859  tree = zswap_trees[Extract the `type' field from a swp_entry_t. The swp_entry_t is in* arch-independent format]
860  offset = Extract the `offset' field from a swp_entry_t. The swp_entry_t is in* arch-independent format
863  spin_lock( & lock)
864  entry = aller must hold the tree lock
865  If Not entry Then
867  spin_unlock( & lock)
868  zpool_unmap_handle(pool, handle)
869  Return 0
871  spin_unlock( & lock)
872  BUG_ON(offset != the swap offset for the entry. Index into the red-black tree.)
876  Case zswap_get_swap_cache_page* This is an adaption of read_swap_cache_async()* This function tries to find a page with the given swap entry* in the swapper_space address space (the swap cache). If the page* is found, it is returned in retpage == ZSWAP_SWAPCACHE_FAIL
877  ret = -ENOMEM
878  Go to fail
880  Case zswap_get_swap_cache_page* This is an adaption of read_swap_cache_async()* This function tries to find a page with the given swap entry* in the swapper_space address space (the swap cache). If the page* is found, it is returned in retpage == ZSWAP_SWAPCACHE_EXIST
882  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
883  ret = -EEXIST
884  Go to fail
886  Case zswap_get_swap_cache_page* This is an adaption of read_swap_cache_async()* This function tries to find a page with the given swap entry* in the swapper_space address space (the swap cache). If the page* is found, it is returned in retpage == ZSWAP_SWAPCACHE_NEW
888  dlen = PAGE_SIZE
889  src = zhdr + sizeof(structzswap_header)
890  dst = kmap_atomic(page)
891  tfm = get_cpu_ptr(tfm)
892  ret = crypto_comp_decompress(tfm, src, the length in bytes of the compressed page data. Needed during, dst, & dlen)
894  put_cpu_ptr(tfm)
895  Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(dst)
896  BUG_ON(ret)
897  BUG_ON(dlen != PAGE_SIZE)
900  SetPageUptodate(page)
904  PG_readahead is only used for reads; PG_reclaim is only for writes
907  __swap_writepage(page, & wbc, end_swap_bio_write)
908  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
909  Pages written back when pool limit was reached ++
911  spin_lock( & lock)
913  aller must hold the tree lock* remove from the tree and free it, if nobody reference the entry
922  If entry == ree functions Then aller must hold the tree lock* remove from the tree and free it, if nobody reference the entry
924  spin_unlock( & lock)
926  Go to end
935  fail :
936  spin_lock( & lock)
937  aller must hold the tree lock* remove from the tree and free it, if nobody reference the entry
938  spin_unlock( & lock)
940  end :
941  zpool_unmap_handle(pool, handle)
942  Return ret