~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/iomap/iter.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/iomap/iter.c (Version linux-6.12-rc7) and /fs/iomap/iter.c (Version linux-4.12.14)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * Copyright (C) 2010 Red Hat, Inc.               
  4  * Copyright (c) 2016-2021 Christoph Hellwig.     
  5  */                                               
  6 #include <linux/fs.h>                             
  7 #include <linux/iomap.h>                          
  8 #include "trace.h"                                
  9                                                   
 10 /*                                                
 11  * Advance to the next range we need to map.      
 12  *                                                
 13  * If the iomap is marked IOMAP_F_STALE, it me    
 14  * processed - it was aborted because the exte    
 15  * changed during the operation. In this case,    
 16  * remap the unprocessed range of the iter, an    
 17  * even when we've made no progress (i.e. iter    
 18  * "finished iterating" case needs to distingu    
 19  * (processed = 0) meaning we are done and (pr    
 20  * need to remap the entire remaining range.      
 21  */                                               
 22 static inline int iomap_iter_advance(struct io    
 23 {                                                 
 24         bool stale = iter->iomap.flags & IOMAP    
 25                                                   
 26         /* handle the previous iteration (if a    
 27         if (iter->iomap.length) {                 
 28                 if (iter->processed < 0)          
 29                         return iter->processed    
 30                 if (!iter->processed && !stale    
 31                         return 0;                 
 32                 if (WARN_ON_ONCE(iter->process    
 33                         return -EIO;              
 34                 iter->pos += iter->processed;     
 35                 iter->len -= iter->processed;     
 36                 if (!iter->len)                   
 37                         return 0;                 
 38         }                                         
 39                                                   
 40         /* clear the state for the next iterat    
 41         iter->processed = 0;                      
 42         memset(&iter->iomap, 0, sizeof(iter->i    
 43         memset(&iter->srcmap, 0, sizeof(iter->    
 44         return 1;                                 
 45 }                                                 
 46                                                   
 47 static inline void iomap_iter_done(struct ioma    
 48 {                                                 
 49         WARN_ON_ONCE(iter->iomap.offset > iter    
 50         WARN_ON_ONCE(iter->iomap.length == 0);    
 51         WARN_ON_ONCE(iter->iomap.offset + iter    
 52         WARN_ON_ONCE(iter->iomap.flags & IOMAP    
 53                                                   
 54         trace_iomap_iter_dstmap(iter->inode, &    
 55         if (iter->srcmap.type != IOMAP_HOLE)      
 56                 trace_iomap_iter_srcmap(iter->    
 57 }                                                 
 58                                                   
 59 /**                                               
 60  * iomap_iter - iterate over a ranges in a fil    
 61  * @iter: iteration structue                      
 62  * @ops: iomap ops provided by the file system    
 63  *                                                
 64  * Iterate over filesystem-provided space mapp    
 65  *                                                
 66  * This function handles cleanup of resources     
 67  * filesystem indicates there are no more spac    
 68  * function must be called in a loop that cont    
 69  * positive value.  If 0 or a negative value i    
 70  * return to the loop body.  Within a loop bod    
 71  * of the loop body:  leave @iter.processed un    
 72  * errno.                                         
 73  */                                               
 74 int iomap_iter(struct iomap_iter *iter, const     
 75 {                                                 
 76         int ret;                                  
 77                                                   
 78         if (iter->iomap.length && ops->iomap_e    
 79                 ret = ops->iomap_end(iter->ino    
 80                                 iter->processe    
 81                                 iter->flags, &    
 82                 if (ret < 0 && !iter->processe    
 83                         return ret;               
 84         }                                         
 85                                                   
 86         trace_iomap_iter(iter, ops, _RET_IP_);    
 87         ret = iomap_iter_advance(iter);           
 88         if (ret <= 0)                             
 89                 return ret;                       
 90                                                   
 91         ret = ops->iomap_begin(iter->inode, it    
 92                                &iter->iomap, &    
 93         if (ret < 0)                              
 94                 return ret;                       
 95         iomap_iter_done(iter);                    
 96         return 1;                                 
 97 }                                                 
 98                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php