0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/fs.h>
0010 #include <linux/buffer_head.h>
0011 #include <linux/kernel.h>
0012 #include <linux/pagemap.h>
0013
0014 #include "vxfs_extern.h"
0015
0016
0017 static int vxfs_read_folio(struct file *, struct folio *);
0018 static sector_t vxfs_bmap(struct address_space *, sector_t);
0019
0020 const struct address_space_operations vxfs_aops = {
0021 .read_folio = vxfs_read_folio,
0022 .bmap = vxfs_bmap,
0023 };
0024
0025 inline void
0026 vxfs_put_page(struct page *pp)
0027 {
0028 kunmap(pp);
0029 put_page(pp);
0030 }
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 struct page *
0044 vxfs_get_page(struct address_space *mapping, u_long n)
0045 {
0046 struct page * pp;
0047
0048 pp = read_mapping_page(mapping, n, NULL);
0049
0050 if (!IS_ERR(pp)) {
0051 kmap(pp);
0052
0053
0054 }
0055
0056 return (pp);
0057 }
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 struct buffer_head *
0072 vxfs_bread(struct inode *ip, int block)
0073 {
0074 struct buffer_head *bp;
0075 daddr_t pblock;
0076
0077 pblock = vxfs_bmap1(ip, block);
0078 bp = sb_bread(ip->i_sb, pblock);
0079
0080 return (bp);
0081 }
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 static int
0099 vxfs_getblk(struct inode *ip, sector_t iblock,
0100 struct buffer_head *bp, int create)
0101 {
0102 daddr_t pblock;
0103
0104 pblock = vxfs_bmap1(ip, iblock);
0105 if (pblock != 0) {
0106 map_bh(bp, ip->i_sb, pblock);
0107 return 0;
0108 }
0109
0110 return -EIO;
0111 }
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 static int vxfs_read_folio(struct file *file, struct folio *folio)
0129 {
0130 return block_read_full_folio(folio, vxfs_getblk);
0131 }
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148 static sector_t
0149 vxfs_bmap(struct address_space *mapping, sector_t block)
0150 {
0151 return generic_block_bmap(mapping, block, vxfs_getblk);
0152 }