Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * uptodate.h
0004  *
0005  * Cluster uptodate tracking
0006  *
0007  * Copyright (C) 2002, 2004, 2005 Oracle.  All rights reserved.
0008  */
0009 
0010 #ifndef OCFS2_UPTODATE_H
0011 #define OCFS2_UPTODATE_H
0012 
0013 /*
0014  * The caching code relies on locking provided by the user of
0015  * struct ocfs2_caching_info.  These operations connect that up.
0016  */
0017 struct ocfs2_caching_operations {
0018     /*
0019      * A u64 representing the owning structure.  Usually this
0020      * is the block number (i_blkno or whatnot).  This is used so
0021      * that caching log messages can identify the owning structure.
0022      */
0023     u64 (*co_owner)(struct ocfs2_caching_info *ci);
0024 
0025     /* The superblock is needed during I/O. */
0026     struct super_block *(*co_get_super)(struct ocfs2_caching_info *ci);
0027     /*
0028      * Lock and unlock the caching data.  These will not sleep, and
0029      * should probably be spinlocks.
0030      */
0031     void    (*co_cache_lock)(struct ocfs2_caching_info *ci);
0032     void    (*co_cache_unlock)(struct ocfs2_caching_info *ci);
0033 
0034     /*
0035      * Lock and unlock for disk I/O.  These will sleep, and should
0036      * be mutexes.
0037      */
0038     void    (*co_io_lock)(struct ocfs2_caching_info *ci);
0039     void    (*co_io_unlock)(struct ocfs2_caching_info *ci);
0040 };
0041 
0042 int __init init_ocfs2_uptodate_cache(void);
0043 void exit_ocfs2_uptodate_cache(void);
0044 
0045 void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,
0046                    const struct ocfs2_caching_operations *ops);
0047 void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci);
0048 void ocfs2_metadata_cache_exit(struct ocfs2_caching_info *ci);
0049 
0050 u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci);
0051 void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci);
0052 void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci);
0053 
0054 int ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci,
0055               struct buffer_head *bh);
0056 void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
0057                    struct buffer_head *bh);
0058 void ocfs2_set_new_buffer_uptodate(struct ocfs2_caching_info *ci,
0059                    struct buffer_head *bh);
0060 void ocfs2_remove_from_cache(struct ocfs2_caching_info *ci,
0061                  struct buffer_head *bh);
0062 void ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci,
0063                         sector_t block,
0064                         u32 c_len);
0065 int ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci,
0066                 struct buffer_head *bh);
0067 
0068 #endif /* OCFS2_UPTODATE_H */