Blame view

fs/gfs2/meta_io.h 2.43 KB
7336d0e65   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
b3b94faa5   David Teigland   [GFS2] The core o...
2
3
  /*
   * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
3a8a9a103   Steven Whitehouse   [GFS2] Update cop...
4
   * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
b3b94faa5   David Teigland   [GFS2] The core o...
5
6
7
8
   */
  
  #ifndef __DIO_DOT_H__
  #define __DIO_DOT_H__
f2f7ba523   Steven Whitehouse   [GFS2] Make heade...
9
10
11
  #include <linux/buffer_head.h>
  #include <linux/string.h>
  #include "incore.h"
b3b94faa5   David Teigland   [GFS2] The core o...
12
13
14
15
16
17
18
  static inline void gfs2_buffer_clear(struct buffer_head *bh)
  {
  	memset(bh->b_data, 0, bh->b_size);
  }
  
  static inline void gfs2_buffer_clear_tail(struct buffer_head *bh, int head)
  {
420b9e5e4   Steven Whitehouse   [GFS2] Tidy up in...
19
  	BUG_ON(head > bh->b_size);
b3b94faa5   David Teigland   [GFS2] The core o...
20
21
  	memset(bh->b_data + head, 0, bh->b_size - head);
  }
b3b94faa5   David Teigland   [GFS2] The core o...
22
23
24
25
26
  static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh,
  					 int to_head,
  					 struct buffer_head *from_bh,
  					 int from_head)
  {
420b9e5e4   Steven Whitehouse   [GFS2] Tidy up in...
27
28
  	BUG_ON(from_head < to_head);
  	memcpy(to_bh->b_data + to_head, from_bh->b_data + from_head,
b3b94faa5   David Teigland   [GFS2] The core o...
29
30
  	       from_bh->b_size - from_head);
  	memset(to_bh->b_data + to_bh->b_size + to_head - from_head,
420b9e5e4   Steven Whitehouse   [GFS2] Tidy up in...
31
  	       0, from_head - to_head);
b3b94faa5   David Teigland   [GFS2] The core o...
32
  }
009d85183   Steven Whitehouse   GFS2: Metadata ad...
33
  extern const struct address_space_operations gfs2_meta_aops;
1b2ad4121   Steven Whitehouse   GFS2: Fix address...
34
  extern const struct address_space_operations gfs2_rgrp_aops;
009d85183   Steven Whitehouse   GFS2: Metadata ad...
35
36
37
38
39
  
  static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
  {
  	struct inode *inode = mapping->host;
  	if (mapping->a_ops == &gfs2_meta_aops)
15562c439   Bob Peterson   GFS2: Move glock ...
40
  		return (((struct gfs2_glock *)mapping) - 1)->gl_name.ln_sbd;
1b2ad4121   Steven Whitehouse   GFS2: Fix address...
41
42
  	else if (mapping->a_ops == &gfs2_rgrp_aops)
  		return container_of(mapping, struct gfs2_sbd, sd_aspace);
009d85183   Steven Whitehouse   GFS2: Metadata ad...
43
44
45
  	else
  		return inode->i_sb->s_fs_info;
  }
b3b94faa5   David Teigland   [GFS2] The core o...
46

7c0ef28a2   Steven Whitehouse   GFS2: Move gfs2_s...
47
48
  extern struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno);
  extern int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
c8d577038   Andreas Gruenbacher   gfs2: Extended at...
49
  			  int rahead, struct buffer_head **bhp);
7c0ef28a2   Steven Whitehouse   GFS2: Move gfs2_s...
50
51
52
  extern int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh);
  extern struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno,
  				       int create);
68cd4ce2c   Bob Peterson   GFS2: Refactor gf...
53
54
55
56
57
58
  enum {
  	REMOVE_JDATA = 0,
  	REMOVE_META = 1,
  };
  
  extern void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
7c0ef28a2   Steven Whitehouse   GFS2: Move gfs2_s...
59
60
61
  extern void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen);
  extern int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
  				     struct buffer_head **bhp);
b3b94faa5   David Teigland   [GFS2] The core o...
62
63
64
65
  
  static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip,
  					 struct buffer_head **bhp)
  {
f2f9c8124   Bob Peterson   GFS2: Eliminate u...
66
  	return gfs2_meta_indirect_buffer(ip, 0, ip->i_no_addr, bhp);
b3b94faa5   David Teigland   [GFS2] The core o...
67
  }
7276b3b0c   Steven Whitehouse   [GFS2] Tidy up me...
68
  struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen);
b3b94faa5   David Teigland   [GFS2] The core o...
69

ddacfaf76   Steven Whitehouse   [GFS2] Move loggi...
70
71
  #define buffer_busy(bh) \
  ((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock) | (1ul << BH_Pinned)))
ddacfaf76   Steven Whitehouse   [GFS2] Move loggi...
72

b3b94faa5   David Teigland   [GFS2] The core o...
73
  #endif /* __DIO_DOT_H__ */