1b3b94faaSDavid Teigland /* 2b3b94faaSDavid Teigland * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3*3a8a9a10SSteven 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 { 20b3b94faaSDavid Teigland memset(bh->b_data + head, 0, bh->b_size - head); 21b3b94faaSDavid Teigland } 22b3b94faaSDavid Teigland 23b3b94faaSDavid Teigland static inline void gfs2_buffer_clear_ends(struct buffer_head *bh, int offset, 24b3b94faaSDavid Teigland int amount, int journaled) 25b3b94faaSDavid Teigland { 26b3b94faaSDavid Teigland int z_off1 = (journaled) ? sizeof(struct gfs2_meta_header) : 0; 27b3b94faaSDavid Teigland int z_len1 = offset - z_off1; 28b3b94faaSDavid Teigland int z_off2 = offset + amount; 29b3b94faaSDavid Teigland int z_len2 = (bh)->b_size - z_off2; 30b3b94faaSDavid Teigland 31b3b94faaSDavid Teigland if (z_len1) 32b3b94faaSDavid Teigland memset(bh->b_data + z_off1, 0, z_len1); 33b3b94faaSDavid Teigland 34b3b94faaSDavid Teigland if (z_len2) 35b3b94faaSDavid Teigland memset(bh->b_data + z_off2, 0, z_len2); 36b3b94faaSDavid Teigland } 37b3b94faaSDavid Teigland 38b3b94faaSDavid Teigland static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh, 39b3b94faaSDavid Teigland int to_head, 40b3b94faaSDavid Teigland struct buffer_head *from_bh, 41b3b94faaSDavid Teigland int from_head) 42b3b94faaSDavid Teigland { 43b3b94faaSDavid Teigland memcpy(to_bh->b_data + to_head, 44b3b94faaSDavid Teigland from_bh->b_data + from_head, 45b3b94faaSDavid Teigland from_bh->b_size - from_head); 46b3b94faaSDavid Teigland memset(to_bh->b_data + to_bh->b_size + to_head - from_head, 47b3b94faaSDavid Teigland 0, 48b3b94faaSDavid Teigland from_head - to_head); 49b3b94faaSDavid Teigland } 50b3b94faaSDavid Teigland 51b3b94faaSDavid Teigland struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp); 52b3b94faaSDavid Teigland void gfs2_aspace_put(struct inode *aspace); 53b3b94faaSDavid Teigland 54b3b94faaSDavid Teigland void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai); 55b3b94faaSDavid Teigland int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int flags); 56b3b94faaSDavid Teigland void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai); 57b3b94faaSDavid Teigland void gfs2_ail_empty_gl(struct gfs2_glock *gl); 58b3b94faaSDavid Teigland 59b3b94faaSDavid Teigland void gfs2_meta_inval(struct gfs2_glock *gl); 60b3b94faaSDavid Teigland void gfs2_meta_sync(struct gfs2_glock *gl, int flags); 61b3b94faaSDavid Teigland 62b3b94faaSDavid Teigland struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, uint64_t blkno); 63b3b94faaSDavid Teigland int gfs2_meta_read(struct gfs2_glock *gl, uint64_t blkno, 64b3b94faaSDavid Teigland int flags, struct buffer_head **bhp); 65b3b94faaSDavid Teigland int gfs2_meta_reread(struct gfs2_sbd *sdp, struct buffer_head *bh, int flags); 66b3b94faaSDavid Teigland 67568f4c96SSteven Whitehouse void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, 68568f4c96SSteven Whitehouse int meta); 69a98ab220SSteven Whitehouse void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); 70a98ab220SSteven Whitehouse void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, 71b3b94faaSDavid Teigland struct gfs2_ail *ai); 72b3b94faaSDavid Teigland 73b3b94faaSDavid Teigland void gfs2_meta_wipe(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen); 74b3b94faaSDavid Teigland 75b3b94faaSDavid Teigland void gfs2_meta_cache_flush(struct gfs2_inode *ip); 76b3b94faaSDavid Teigland int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num, 77b3b94faaSDavid Teigland int new, struct buffer_head **bhp); 78b3b94faaSDavid Teigland 79b3b94faaSDavid Teigland static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip, 80b3b94faaSDavid Teigland struct buffer_head **bhp) 81b3b94faaSDavid Teigland { 82b3b94faaSDavid Teigland return gfs2_meta_indirect_buffer(ip, 0, ip->i_num.no_addr, 0, bhp); 83b3b94faaSDavid Teigland } 84b3b94faaSDavid Teigland 85b3b94faaSDavid Teigland void gfs2_meta_ra(struct gfs2_glock *gl, uint64_t dblock, uint32_t extlen); 86b3b94faaSDavid Teigland void gfs2_meta_syncfs(struct gfs2_sbd *sdp); 87b3b94faaSDavid Teigland 88b3b94faaSDavid Teigland #endif /* __DIO_DOT_H__ */ 89b3b94faaSDavid Teigland 90