Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #ifndef __RGRP_DOT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #define __RGRP_DOT_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* Since each block in the file system is represented by two bits in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * bitmap, one 64-bit word in the bitmap will represent 32 blocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * By reserving 32 blocks at a time, we can optimize / shortcut how we search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * through the bitmaps by looking a word at a time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define RGRP_RSRV_MINBLKS 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define RGRP_RSRV_ADDBLKS 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct gfs2_rgrpd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct gfs2_sbd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct gfs2_holder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) extern struct gfs2_rgrpd *gfs2_rgrpd_get_first(struct gfs2_sbd *sdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) extern struct gfs2_rgrpd *gfs2_rgrpd_get_next(struct gfs2_rgrpd *rgd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) extern int gfs2_rindex_update(struct gfs2_sbd *sdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern void gfs2_free_clones(struct gfs2_rgrpd *rgd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern int gfs2_rgrp_go_lock(struct gfs2_holder *gh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define GFS2_AF_ORLOV 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern int gfs2_inplace_reserve(struct gfs2_inode *ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 				struct gfs2_alloc_parms *ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern void gfs2_inplace_release(struct gfs2_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *n,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 			     bool dinode, u64 *generation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) extern void gfs2_rs_deltree(struct gfs2_blkreserv *rs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern void gfs2_rs_delete(struct gfs2_inode *ip, atomic_t *wcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) extern void __gfs2_free_blocks(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 			       u64 bstart, u32 blen, int meta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern void gfs2_free_meta(struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 			   u64 bstart, u32 blen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) extern void gfs2_unlink_di(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			       unsigned int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct gfs2_rgrp_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	unsigned int rl_rgrps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	unsigned int rl_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	struct gfs2_rgrpd **rl_rgd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	struct gfs2_holder *rl_ghs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 			   u64 block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) extern u64 gfs2_ri_total(struct gfs2_sbd *sdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) extern void gfs2_rgrp_dump(struct seq_file *seq, struct gfs2_rgrpd *rgd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 			   const char *fs_id_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 				   struct buffer_head *bh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 				   const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) extern int gfs2_fitrim(struct file *filp, void __user *argp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* This is how to tell if a reservation is in the rgrp tree: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static inline bool gfs2_rs_active(const struct gfs2_blkreserv *rs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	return rs && !RB_EMPTY_NODE(&rs->rs_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) static inline int rgrp_contains_block(struct gfs2_rgrpd *rgd, u64 block)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 	u64 first = rgd->rd_data0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 	u64 last = first + rgd->rd_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	return first <= block && block < last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) extern void check_and_update_goal(struct gfs2_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif /* __RGRP_DOT_H__ */