xref: /linux/fs/gfs2/meta_io.h (revision 420b9e5e45d33355471c8d2d593bb0e5d6c77421)
1b3b94faaSDavid Teigland /*
2b3b94faaSDavid Teigland  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
33a8a9a10SSteven Whitehouse  * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
4b3b94faaSDavid Teigland  *
5b3b94faaSDavid Teigland  * This copyrighted material is made available to anyone wishing to use,
6b3b94faaSDavid Teigland  * modify, copy, or redistribute it subject to the terms and conditions
7b3b94faaSDavid Teigland  * of the GNU General Public License v.2.
8b3b94faaSDavid Teigland  */
9b3b94faaSDavid Teigland 
10b3b94faaSDavid Teigland #ifndef __DIO_DOT_H__
11b3b94faaSDavid Teigland #define __DIO_DOT_H__
12b3b94faaSDavid Teigland 
13b3b94faaSDavid Teigland static inline void gfs2_buffer_clear(struct buffer_head *bh)
14b3b94faaSDavid Teigland {
15b3b94faaSDavid Teigland 	memset(bh->b_data, 0, bh->b_size);
16b3b94faaSDavid Teigland }
17b3b94faaSDavid Teigland 
18b3b94faaSDavid Teigland static inline void gfs2_buffer_clear_tail(struct buffer_head *bh, int head)
19b3b94faaSDavid Teigland {
20*420b9e5eSSteven Whitehouse 	BUG_ON(head > bh->b_size);
21b3b94faaSDavid Teigland 	memset(bh->b_data + head, 0, bh->b_size - head);
22b3b94faaSDavid Teigland }
23b3b94faaSDavid Teigland 
24b3b94faaSDavid Teigland static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh,
25b3b94faaSDavid Teigland 					 int to_head,
26b3b94faaSDavid Teigland 					 struct buffer_head *from_bh,
27b3b94faaSDavid Teigland 					 int from_head)
28b3b94faaSDavid Teigland {
29*420b9e5eSSteven Whitehouse 	BUG_ON(from_head < to_head);
30*420b9e5eSSteven Whitehouse 	memcpy(to_bh->b_data + to_head, from_bh->b_data + from_head,
31b3b94faaSDavid Teigland 	       from_bh->b_size - from_head);
32b3b94faaSDavid Teigland 	memset(to_bh->b_data + to_bh->b_size + to_head - from_head,
33*420b9e5eSSteven Whitehouse 	       0, from_head - to_head);
34b3b94faaSDavid Teigland }
35b3b94faaSDavid Teigland 
36b3b94faaSDavid Teigland struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp);
37b3b94faaSDavid Teigland void gfs2_aspace_put(struct inode *aspace);
38b3b94faaSDavid Teigland 
39b3b94faaSDavid Teigland void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai);
40b3b94faaSDavid Teigland int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags);
41b3b94faaSDavid Teigland void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai);
42b3b94faaSDavid Teigland void gfs2_ail_empty_gl(struct gfs2_glock *gl);
43b3b94faaSDavid Teigland 
44b3b94faaSDavid Teigland void gfs2_meta_inval(struct gfs2_glock *gl);
45b3b94faaSDavid Teigland void gfs2_meta_sync(struct gfs2_glock *gl, int flags);
46b3b94faaSDavid Teigland 
47b3b94faaSDavid Teigland struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, uint64_t blkno);
48b3b94faaSDavid Teigland int gfs2_meta_read(struct gfs2_glock *gl, uint64_t blkno,
49b3b94faaSDavid Teigland 		   int flags, struct buffer_head **bhp);
50b3b94faaSDavid Teigland int gfs2_meta_reread(struct gfs2_sbd *sdp, struct buffer_head *bh, int flags);
51b3b94faaSDavid Teigland 
52568f4c96SSteven Whitehouse void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
53568f4c96SSteven Whitehouse 			 int meta);
54a98ab220SSteven Whitehouse void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
55a98ab220SSteven Whitehouse void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
56b3b94faaSDavid Teigland 		struct gfs2_ail *ai);
57b3b94faaSDavid Teigland 
58b3b94faaSDavid Teigland void gfs2_meta_wipe(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen);
59b3b94faaSDavid Teigland 
60b3b94faaSDavid Teigland void gfs2_meta_cache_flush(struct gfs2_inode *ip);
61b3b94faaSDavid Teigland int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num,
62b3b94faaSDavid Teigland 			      int new, struct buffer_head **bhp);
63b3b94faaSDavid Teigland 
64b3b94faaSDavid Teigland static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip,
65b3b94faaSDavid Teigland 					 struct buffer_head **bhp)
66b3b94faaSDavid Teigland {
67b3b94faaSDavid Teigland 	return gfs2_meta_indirect_buffer(ip, 0, ip->i_num.no_addr, 0, bhp);
68b3b94faaSDavid Teigland }
69b3b94faaSDavid Teigland 
70b3b94faaSDavid Teigland void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen);
71b3b94faaSDavid Teigland void gfs2_meta_syncfs(struct gfs2_sbd *sdp);
72b3b94faaSDavid Teigland 
73b3b94faaSDavid Teigland #endif /* __DIO_DOT_H__ */
74b3b94faaSDavid Teigland 
75