18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* -*- mode: c; c-basic-offset: 8; -*- 38c2ecf20Sopenharmony_ci * vim: noexpandtab sw=8 ts=8 sts=0: 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * uptodate.h 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Cluster uptodate tracking 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Copyright (C) 2002, 2004, 2005 Oracle. All rights reserved. 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#ifndef OCFS2_UPTODATE_H 138c2ecf20Sopenharmony_ci#define OCFS2_UPTODATE_H 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* 168c2ecf20Sopenharmony_ci * The caching code relies on locking provided by the user of 178c2ecf20Sopenharmony_ci * struct ocfs2_caching_info. These operations connect that up. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_cistruct ocfs2_caching_operations { 208c2ecf20Sopenharmony_ci /* 218c2ecf20Sopenharmony_ci * A u64 representing the owning structure. Usually this 228c2ecf20Sopenharmony_ci * is the block number (i_blkno or whatnot). This is used so 238c2ecf20Sopenharmony_ci * that caching log messages can identify the owning structure. 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci u64 (*co_owner)(struct ocfs2_caching_info *ci); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci /* The superblock is needed during I/O. */ 288c2ecf20Sopenharmony_ci struct super_block *(*co_get_super)(struct ocfs2_caching_info *ci); 298c2ecf20Sopenharmony_ci /* 308c2ecf20Sopenharmony_ci * Lock and unlock the caching data. These will not sleep, and 318c2ecf20Sopenharmony_ci * should probably be spinlocks. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci void (*co_cache_lock)(struct ocfs2_caching_info *ci); 348c2ecf20Sopenharmony_ci void (*co_cache_unlock)(struct ocfs2_caching_info *ci); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci /* 378c2ecf20Sopenharmony_ci * Lock and unlock for disk I/O. These will sleep, and should 388c2ecf20Sopenharmony_ci * be mutexes. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci void (*co_io_lock)(struct ocfs2_caching_info *ci); 418c2ecf20Sopenharmony_ci void (*co_io_unlock)(struct ocfs2_caching_info *ci); 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciint __init init_ocfs2_uptodate_cache(void); 458c2ecf20Sopenharmony_civoid exit_ocfs2_uptodate_cache(void); 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_civoid ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, 488c2ecf20Sopenharmony_ci const struct ocfs2_caching_operations *ops); 498c2ecf20Sopenharmony_civoid ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci); 508c2ecf20Sopenharmony_civoid ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci); 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciu64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci); 538c2ecf20Sopenharmony_civoid ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci); 548c2ecf20Sopenharmony_civoid ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciint ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci, 578c2ecf20Sopenharmony_ci struct buffer_head *bh); 588c2ecf20Sopenharmony_civoid ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, 598c2ecf20Sopenharmony_ci struct buffer_head *bh); 608c2ecf20Sopenharmony_civoid ocfs2_set_new_buffer_uptodate(struct ocfs2_caching_info *ci, 618c2ecf20Sopenharmony_ci struct buffer_head *bh); 628c2ecf20Sopenharmony_civoid ocfs2_remove_from_cache(struct ocfs2_caching_info *ci, 638c2ecf20Sopenharmony_ci struct buffer_head *bh); 648c2ecf20Sopenharmony_civoid ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci, 658c2ecf20Sopenharmony_ci sector_t block, 668c2ecf20Sopenharmony_ci u32 c_len); 678c2ecf20Sopenharmony_ciint ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci, 688c2ecf20Sopenharmony_ci struct buffer_head *bh); 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#endif /* OCFS2_UPTODATE_H */ 71