Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bio-integrity.c Create Date:2022-07-28 18:02:29
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_integrity_prep - Prepare bio for integrity I/O*@bio: bio to prepare* Description: Checks if the bio already has an integrity payload attached.* If it does, the payload has been generated by another kernel subsystem,* and we just pass it through

Proto:bool bio_integrity_prep(struct bio *bio)

Type:bool

Parameter:

TypeParameterName
struct bio *bio
202  bi = blk_get_integrity(bi_disk)
203  q = queue
211  If Not bi Then Return true
214  If bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE Then Return true
217  If Not bio_sectors(bio) Then Return true
221  If bio_integrity(bio) Then Return true
224  If Return the data direction, READ or WRITE.(bio) == generic data direction definitions Then
225  If Not verify_fn || Not (flags & BLK_INTEGRITY_VERIFY) Then Return true
228  Else
229  If Not generate_fn || Not (flags & BLK_INTEGRITY_GENERATE) Then Return true
233  intervals = _integrity_intervals - Return number of integrity intervals for a bio*@bi: blk_integrity profile for device*@sectors: Size of the bio in 512-byte sectors* Description: The block layer calculates everything in 512 byte* sectors but integrity metadata is
236  len = intervals * tuple_size
237  buf = Allocation memory
238  status = BLK_STS_RESOURCE
239  If Value for the false possibility is greater at compile time(buf == NULL) Then
240  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
241  Go to err_end_io
244  end = buf + len + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
245  start = buf >> PAGE_SHIFT determines the page size
246  nr_pages = end - start
249  bip = _integrity_alloc - Allocate integrity payload and attach it to bio*@bio: bio to attach integrity metadata to*@gfp_mask: Memory allocation mask*@nr_vecs: Number of integrity metadata scatter-gather elements* Description: This function prepares a bio for
250  If IS_ERR(bip) Then
251  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
252  kfree(buf)
253  status = BLK_STS_RESOURCE
254  Go to err_end_io
257  control flags |= BIP_BLOCK_INTEGRITY
258  residual I/O count = len
259  bip_set_seed(bip, device address in 512 byte sectors )
261  If flags & BLK_INTEGRITY_IP_CHECKSUM Then control flags |= BIP_IP_CHECKSUM
265  offset = offset_in_page(buf)
266  When i < nr_pages cycle
268  bytes = PAGE_SIZE - offset
270  If len <= 0 Then Break
273  If bytes > len Then bytes = len
276  ret = _integrity_add_page - Attach integrity metadata*@bio: bio to update*@page: page containing integrity metadata*@len: number of bytes of integrity metadata in page*@offset: start offset within page
279  If ret == 0 Then
281  kfree(buf)
283  Go to err_end_io
286  If ret < bytes Then Break
289  buf += bytes
290  len -= bytes
291  offset = 0
295  If Return the data direction, READ or WRITE.(bio) == WRITE Then
296  _integrity_process - Process integrity metadata for a bio*@bio: bio to generate/verify integrity metadata for*@proc_iter: iterator to process*@proc_fn: Pointer to the relevant processing function
298  Else
299  r rewinding parent bio = bi_iter
301  Return true
303  err_end_io :
304  bi_status = status
305  _endio - end I/O on a bio*@bio: bio* Description:* bio_endio() will end I/O on the whole bio. bio_endio() is the preferred* way to end I/O on a bio. No one should call bi_end_io() directly on a
306  Return false
Caller
NameDescribe
blk_mq_make_request