Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
0004  * Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
0005  */
0006 
0007 #ifndef __LOPS_DOT_H__
0008 #define __LOPS_DOT_H__
0009 
0010 #include <linux/list.h>
0011 #include "incore.h"
0012 
0013 extern const struct gfs2_log_operations *gfs2_log_ops[];
0014 extern void gfs2_log_incr_head(struct gfs2_sbd *sdp);
0015 extern u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lbn);
0016 extern void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
0017                struct page *page, unsigned size, unsigned offset,
0018                u64 blkno);
0019 extern void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf);
0020 extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
0021 extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
0022                struct gfs2_log_header_host *head, bool keep_cache);
0023 extern void gfs2_drain_revokes(struct gfs2_sbd *sdp);
0024 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
0025 {
0026     return sdp->sd_ldptrs;
0027 }
0028 
0029 static inline unsigned int databuf_limit(struct gfs2_sbd *sdp)
0030 {
0031     return sdp->sd_ldptrs / 2;
0032 }
0033 
0034 static inline void lops_before_commit(struct gfs2_sbd *sdp,
0035                       struct gfs2_trans *tr)
0036 {
0037     int x;
0038     for (x = 0; gfs2_log_ops[x]; x++)
0039         if (gfs2_log_ops[x]->lo_before_commit)
0040             gfs2_log_ops[x]->lo_before_commit(sdp, tr);
0041 }
0042 
0043 static inline void lops_after_commit(struct gfs2_sbd *sdp,
0044                      struct gfs2_trans *tr)
0045 {
0046     int x;
0047     for (x = 0; gfs2_log_ops[x]; x++)
0048         if (gfs2_log_ops[x]->lo_after_commit)
0049             gfs2_log_ops[x]->lo_after_commit(sdp, tr);
0050 }
0051 
0052 static inline void lops_before_scan(struct gfs2_jdesc *jd,
0053                     struct gfs2_log_header_host *head,
0054                     unsigned int pass)
0055 {
0056     int x;
0057     for (x = 0; gfs2_log_ops[x]; x++)
0058         if (gfs2_log_ops[x]->lo_before_scan)
0059             gfs2_log_ops[x]->lo_before_scan(jd, head, pass);
0060 }
0061 
0062 static inline int lops_scan_elements(struct gfs2_jdesc *jd, u32 start,
0063                      struct gfs2_log_descriptor *ld,
0064                      __be64 *ptr,
0065                      unsigned int pass)
0066 {
0067     int x, error;
0068     for (x = 0; gfs2_log_ops[x]; x++)
0069         if (gfs2_log_ops[x]->lo_scan_elements) {
0070             error = gfs2_log_ops[x]->lo_scan_elements(jd, start,
0071                                   ld, ptr, pass);
0072             if (error)
0073                 return error;
0074         }
0075 
0076     return 0;
0077 }
0078 
0079 static inline void lops_after_scan(struct gfs2_jdesc *jd, int error,
0080                    unsigned int pass)
0081 {
0082     int x;
0083     for (x = 0; gfs2_log_ops[x]; x++)
0084         if (gfs2_log_ops[x]->lo_before_scan)
0085             gfs2_log_ops[x]->lo_after_scan(jd, error, pass);
0086 }
0087 
0088 #endif /* __LOPS_DOT_H__ */
0089