/* *Per-inodecontext.ThiswrapstheVFSinode.
*/ struct netfs_inode { struct inode inode; /* The VFS inode */ conststruct netfs_request_ops *ops; #if IS_ENABLED(CONFIG_FSCACHE) struct fscache_cookie *cache; #endif struct mutex wb_lock; /* Writeback serialisation */
loff_t remote_i_size; /* Size of the remote file */
loff_t zero_point; /* Size after which we assume there's no data
* on the server */
atomic_t io_count; /* Number of outstanding reqs */ unsignedlong flags; #define NETFS_ICTX_ODIRECT 0/* The file has DIO in progress */ #define NETFS_ICTX_UNBUFFERED 1/* I/O should not use the pagecache */ #define NETFS_ICTX_MODIFIED_ATTR 3/* Indicate change in mtime/ctime */ #define NETFS_ICTX_SINGLE_NO_UPLOAD 4/* Monolithic payload, cache but no upload */
};
finfo = netfs_folio_info(folio); if (finfo) return finfo->netfs_group; return priv;
}
/* *StreamofI/Osubrequestsgoingtoaparticulardestination,suchasthe *serverorthelocalcache.Thisismainlyintendedforwritingwherewemay *havetowritetomultipledestinationsconcurrently.
*/ struct netfs_io_stream { /* Submission tracking */ struct netfs_io_subrequest *construct; /* Op being constructed */
size_t sreq_max_len; /* Maximum size of a subrequest */ unsignedint sreq_max_segs; /* 0 or max number of segments in an iterator */ unsignedint submit_off; /* Folio offset we're submitting from */ unsignedint submit_len; /* Amount of data left to submit */ unsignedint submit_extendable_to; /* Amount I/O can be rounded up to */ void (*prepare_write)(struct netfs_io_subrequest *subreq); void (*issue_write)(struct netfs_io_subrequest *subreq); /* Collection tracking */ struct list_head subrequests; /* Contributory I/O operations */ struct netfs_io_subrequest *front; /* Op being collected */ unsignedlonglong collected_to; /* Position we've collected results to */
size_t transferred; /* The amount transferred from this stream */ unsignedshort error; /* Aggregate error for the stream */ enum netfs_io_source source; /* Where to read from/write to */ unsignedchar stream_nr; /* Index of stream in parent table */ bool avail; /* T if stream is available */ bool active; /* T if stream is active */ bool need_retry; /* T if this stream needs retrying */ bool failed; /* T if this stream failed */ bool transferred_valid; /* T is ->transferred is valid */
};
/* *Descriptorforasinglecomponentsubrequest.Eachoperationrepresentsan *individualread/writefrom/toaserver,acache,ajournal,etc.. * *Thebufferiteratorispersistentforthelifeofthesubrequeststructand *thepagesitpointstocanbereliedontoexistfortheduration.
*/ struct netfs_io_subrequest { struct netfs_io_request *rreq; /* Supervising I/O request */ struct work_struct work; struct list_head rreq_link; /* Link in rreq->subrequests */ struct iov_iter io_iter; /* Iterator for this subrequest */ unsignedlonglong start; /* Where to start the I/O */
size_t len; /* Size of the I/O */
size_t transferred; /* Amount of data transferred */
refcount_t ref; short error; /* 0 or error that occurred */ unsignedshort debug_index; /* Index in list (for debugging output) */ unsignedint nr_segs; /* Number of segs in io_iter */
u8 retry_count; /* The number of retries (0 on initial pass) */ enum netfs_io_source source; /* Where to read from/write to */ unsignedchar stream_nr; /* I/O stream this belongs to */ unsignedlong flags; #define NETFS_SREQ_COPY_TO_CACHE 0/* Set if should copy the data to the cache */ #define NETFS_SREQ_CLEAR_TAIL 1/* Set if the rest of the read should be cleared */ #define NETFS_SREQ_MADE_PROGRESS 4/* Set if we transferred at least some data */ #define NETFS_SREQ_ONDEMAND 5/* Set if it's from on-demand read mode */ #define NETFS_SREQ_BOUNDARY 6/* Set if ends on hard boundary (eg. ceph object) */ #define NETFS_SREQ_HIT_EOF 7/* Set if short due to EOF */ #define NETFS_SREQ_IN_PROGRESS 8/* Unlocked when the subrequest completes */ #define NETFS_SREQ_NEED_RETRY 9/* Set if the filesystem requests a retry */ #define NETFS_SREQ_FAILED 10/* Set if the subreq failed unretryably */
};
enum netfs_io_origin {
NETFS_READAHEAD, /* This read was triggered by readahead */
NETFS_READPAGE, /* This read is a synchronous read */
NETFS_READ_GAPS, /* This read is a synchronous read to fill gaps */
NETFS_READ_SINGLE, /* This read should be treated as a single object */
NETFS_READ_FOR_WRITE, /* This read is to prepare a write */
NETFS_UNBUFFERED_READ, /* This is an unbuffered read */
NETFS_DIO_READ, /* This is a direct I/O read */
NETFS_WRITEBACK, /* This write was triggered by writepages */
NETFS_WRITEBACK_SINGLE, /* This monolithic write was triggered by writepages */
NETFS_WRITETHROUGH, /* This write was made by netfs_perform_write() */
NETFS_UNBUFFERED_WRITE, /* This is an unbuffered write */
NETFS_DIO_WRITE, /* This is a direct I/O write */
NETFS_PGPRIV2_COPY_TO_CACHE, /* [DEPRECATED] This is writing read data to the cache */
nr__netfs_io_origin
} __mode(byte);
/* *DescriptorforanI/Ohelperrequest.ThisisusedtomakemultipleI/O *operationstoavarietyofdatastoresandthenstitchtheresulttogether.
*/ struct netfs_io_request { union { struct work_struct cleanup_work; /* Deferred cleanup work */ struct rcu_head rcu;
}; struct work_struct work; /* Result collector work */ struct inode *inode; /* The file being accessed */ struct address_space *mapping; /* The mapping being accessed */ struct kiocb *iocb; /* AIO completion vector */ struct netfs_cache_resources cache_resources; struct netfs_io_request *copy_to_cache; /* Request to write just-read data to the cache */ #ifdef CONFIG_PROC_FS struct list_head proc_link; /* Link in netfs_iorequests */ #endif struct netfs_io_stream io_streams[2]; /* Streams of parallel I/O operations */ #define NR_IO_STREAMS 2//wreq->nr_io_streams struct netfs_group *group; /* Writeback group being written back */ struct rolling_buffer buffer; /* Unencrypted buffer */ #define NETFS_ROLLBUF_PUT_MARK ROLLBUF_MARK_1 #define NETFS_ROLLBUF_PAGECACHE_MARK ROLLBUF_MARK_2
wait_queue_head_t waitq; /* Processor waiter */ void *netfs_priv; /* Private data for the netfs */ void *netfs_priv2; /* Private data for the netfs */ struct bio_vec *direct_bv; /* DIO buffer list (when handling iovec-iter) */ unsignedlonglong submitted; /* Amount submitted for I/O so far */ unsignedlonglong len; /* Length of the request */
size_t transferred; /* Amount to be indicated as transferred */ long error; /* 0 or error that occurred */ unsignedlonglong i_size; /* Size of the file */ unsignedlonglong start; /* Start position */
atomic64_t issued_to; /* Write issuer folio cursor */ unsignedlonglong collected_to; /* Point we've collected to */ unsignedlonglong cleaned_to; /* Position we've cleaned folios to */ unsignedlonglong abandon_to; /* Position to abandon folios to */
pgoff_t no_unlock_folio; /* Don't unlock this folio after read */ unsignedint direct_bv_count; /* Number of elements in direct_bv[] */ unsignedint debug_id; unsignedint rsize; /* Maximum read size (0 for none) */ unsignedint wsize; /* Maximum write size (0 for none) */
atomic_t subreq_counter; /* Next subreq->debug_index */ unsignedint nr_group_rel; /* Number of refs to release on ->group */
spinlock_t lock; /* Lock for queuing subreqs */ unsignedchar front_folio_order; /* Order (size) of front folio */ enum netfs_io_origin origin; /* Origin of the request */ bool direct_bv_unpin; /* T if direct_bv[] must be unpinned */
refcount_t ref; unsignedlong flags; #define NETFS_RREQ_IN_PROGRESS 0/* Unlocked when the request completes (has ref) */ #define NETFS_RREQ_ALL_QUEUED 1/* All subreqs are now queued */ #define NETFS_RREQ_PAUSE 2/* Pause subrequest generation */ #define NETFS_RREQ_FAILED 3/* The request failed */ #define NETFS_RREQ_RETRYING 4/* Set if we're in the retry path */ #define NETFS_RREQ_SHORT_TRANSFER 5/* Set if we have a short transfer */ #define NETFS_RREQ_OFFLOAD_COLLECTION 8/* Offload collection to workqueue */ #define NETFS_RREQ_NO_UNLOCK_FOLIO 9/* Don't unlock no_unlock_folio on completion */ #define NETFS_RREQ_FOLIO_COPY_TO_CACHE 10/* Copy current folio to cache from read */ #define NETFS_RREQ_UPLOAD_TO_SERVER 11/* Need to write to the server */ #define NETFS_RREQ_USE_IO_ITER 12/* Use ->io_iter rather than ->i_pages */ #define NETFS_RREQ_USE_PGPRIV2 31/* [DEPRECATED] Use PG_private_2 to mark
* write to cache on read */ conststruct netfs_request_ops *netfs_ops;
};
/* *Tableofoperationsforaccesstoacache.
*/ struct netfs_cache_ops { /* End an operation */ void (*end_operation)(struct netfs_cache_resources *cres);
/* Read data from the cache */ int (*read)(struct netfs_cache_resources *cres,
loff_t start_pos, struct iov_iter *iter, enum netfs_read_from_hole read_hole,
netfs_io_terminated_t term_func, void *term_func_priv);
/* Write data to the cache */ int (*write)(struct netfs_cache_resources *cres,
loff_t start_pos, struct iov_iter *iter,
netfs_io_terminated_t term_func, void *term_func_priv);
/* Write data to the cache from a netfs subrequest. */ void (*issue_write)(struct netfs_io_subrequest *subreq);
/* Prepare a read operation, shortening it to a cached/uncached *boundaryasappropriate.
*/ enum netfs_io_source (*prepare_read)(struct netfs_io_subrequest *subreq, unsignedlonglong i_size);
/* Prepare a write subrequest, working out if we're allowed to do it *andfindingoutthemaximumamountofdatatogatherbefore *attemptingtosubmit.Ifwe'renotpermittedtodoit,the *subrequestshouldbemarkedfailed.
*/ void (*prepare_write_subreq)(struct netfs_io_subrequest *subreq);
/* Prepare a write operation, working out what part of the write we can *actuallydo.
*/ int (*prepare_write)(struct netfs_cache_resources *cres,
loff_t *_start, size_t *_len, size_t upper_len,
loff_t i_size, bool no_space_allocated_yet);
/* Prepare an on-demand read operation, shortening it to a cached/uncached *boundaryasappropriate.
*/ enum netfs_io_source (*prepare_ondemand_read)(struct netfs_cache_resources *cres,
loff_t start, size_t *_len,
loff_t i_size, unsignedlong *_flags, ino_t ino);
/* Query the occupancy of the cache in a region, returning where the *nextchunkofdatastartsandhowlongitis.
*/ int (*query_occupancy)(struct netfs_cache_resources *cres,
loff_t start, size_t len, size_t granularity,
loff_t *_data_start, size_t *_data_len);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.