diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/bmap.c | 81 | ||||
-rw-r--r-- | fs/gfs2/bmap.h | 2 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 51 | ||||
-rw-r--r-- | fs/gfs2/dir.h | 2 | ||||
-rw-r--r-- | fs/gfs2/eattr.c | 57 | ||||
-rw-r--r-- | fs/gfs2/eattr.h | 2 | ||||
-rw-r--r-- | fs/gfs2/util.c | 30 | ||||
-rw-r--r-- | fs/gfs2/util.h | 8 |
8 files changed, 1 insertions, 232 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 4b4e295b3bf5..bece3620f1c0 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -999,7 +999,7 @@ static int do_shrink(struct gfs2_inode *ip, uint64_t size, | |||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | /** | 1001 | /** |
1002 | * gfs2_truncatei - make a file a give size | 1002 | * gfs2_truncatei - make a file a given size |
1003 | * @ip: the inode | 1003 | * @ip: the inode |
1004 | * @size: the size to make the file | 1004 | * @size: the size to make the file |
1005 | * @truncator: function to truncate the last partial block | 1005 | * @truncator: function to truncate the last partial block |
@@ -1125,82 +1125,3 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset, | |||
1125 | return 0; | 1125 | return 0; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | /** | ||
1129 | * do_gfm - Copy out the dinode/indirect blocks of a file | ||
1130 | * @ip: the file | ||
1131 | * @dibh: the dinode buffer | ||
1132 | * @bh: the indirect buffer we're looking at | ||
1133 | * @top: the first pointer in the block | ||
1134 | * @bottom: one more than the last pointer in the block | ||
1135 | * @height: the height the block is at | ||
1136 | * @data: a pointer to a struct gfs2_user_buffer structure | ||
1137 | * | ||
1138 | * If this is a journaled file, copy out the data too. | ||
1139 | * | ||
1140 | * Returns: errno | ||
1141 | */ | ||
1142 | |||
1143 | static int do_gfm(struct gfs2_inode *ip, struct buffer_head *dibh, | ||
1144 | struct buffer_head *bh, uint64_t *top, uint64_t *bottom, | ||
1145 | unsigned int height, void *data) | ||
1146 | { | ||
1147 | struct gfs2_user_buffer *ub = (struct gfs2_user_buffer *)data; | ||
1148 | int error; | ||
1149 | |||
1150 | error = gfs2_add_bh_to_ub(ub, bh); | ||
1151 | if (error) | ||
1152 | return error; | ||
1153 | |||
1154 | if (!S_ISDIR(ip->i_di.di_mode) || | ||
1155 | height + 1 != ip->i_di.di_height) | ||
1156 | return 0; | ||
1157 | |||
1158 | for (; top < bottom; top++) | ||
1159 | if (*top) { | ||
1160 | struct buffer_head *data_bh; | ||
1161 | |||
1162 | error = gfs2_meta_read(ip->i_gl, be64_to_cpu(*top), | ||
1163 | DIO_START | DIO_WAIT, | ||
1164 | &data_bh); | ||
1165 | if (error) | ||
1166 | return error; | ||
1167 | |||
1168 | error = gfs2_add_bh_to_ub(ub, data_bh); | ||
1169 | |||
1170 | brelse(data_bh); | ||
1171 | |||
1172 | if (error) | ||
1173 | return error; | ||
1174 | } | ||
1175 | |||
1176 | return 0; | ||
1177 | } | ||
1178 | |||
1179 | /** | ||
1180 | * gfs2_get_file_meta - return all the metadata for a file | ||
1181 | * @ip: the file | ||
1182 | * @ub: the structure representing the meta | ||
1183 | * | ||
1184 | * Returns: errno | ||
1185 | */ | ||
1186 | |||
1187 | int gfs2_get_file_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub) | ||
1188 | { | ||
1189 | int error; | ||
1190 | |||
1191 | if (gfs2_is_stuffed(ip)) { | ||
1192 | struct buffer_head *dibh; | ||
1193 | error = gfs2_meta_inode_buffer(ip, &dibh); | ||
1194 | if (!error) { | ||
1195 | error = gfs2_add_bh_to_ub(ub, dibh); | ||
1196 | brelse(dibh); | ||
1197 | } | ||
1198 | } else { | ||
1199 | struct metapath mp; | ||
1200 | find_metapath(ip, 0, &mp); | ||
1201 | error = recursive_scan(ip, NULL, &mp, 0, 0, 1, do_gfm, ub); | ||
1202 | } | ||
1203 | |||
1204 | return error; | ||
1205 | } | ||
1206 | |||
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h index de16e44f049f..25ea32905c67 100644 --- a/fs/gfs2/bmap.h +++ b/fs/gfs2/bmap.h | |||
@@ -34,6 +34,4 @@ void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len, | |||
34 | int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset, | 34 | int gfs2_write_alloc_required(struct gfs2_inode *ip, uint64_t offset, |
35 | unsigned int len, int *alloc_required); | 35 | unsigned int len, int *alloc_required); |
36 | 36 | ||
37 | int gfs2_get_file_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub); | ||
38 | |||
39 | #endif /* __BMAP_DOT_H__ */ | 37 | #endif /* __BMAP_DOT_H__ */ |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 6b1dc3dc3a2d..f6304e55dbc1 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -2104,54 +2104,3 @@ int gfs2_diradd_alloc_required(struct gfs2_inode *dip, struct qstr *filename, | |||
2104 | return error; | 2104 | return error; |
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | /** | ||
2108 | * do_gdm - copy out one leaf (or list of leaves) | ||
2109 | * @dip: the directory | ||
2110 | * @index: the hash table offset in the directory | ||
2111 | * @len: the number of pointers to this leaf | ||
2112 | * @leaf_no: the leaf number | ||
2113 | * @data: a pointer to a struct gfs2_user_buffer structure | ||
2114 | * | ||
2115 | * Returns: errno | ||
2116 | */ | ||
2117 | |||
2118 | static int do_gdm(struct gfs2_inode *dip, uint32_t index, uint32_t len, | ||
2119 | uint64_t leaf_no, void *data) | ||
2120 | { | ||
2121 | struct gfs2_user_buffer *ub = (struct gfs2_user_buffer *)data; | ||
2122 | struct gfs2_leaf leaf; | ||
2123 | struct buffer_head *bh; | ||
2124 | uint64_t blk; | ||
2125 | int error = 0; | ||
2126 | |||
2127 | for (blk = leaf_no; blk; blk = leaf.lf_next) { | ||
2128 | error = get_leaf(dip, blk, &bh); | ||
2129 | if (error) | ||
2130 | break; | ||
2131 | |||
2132 | gfs2_leaf_in(&leaf, bh->b_data); | ||
2133 | |||
2134 | error = gfs2_add_bh_to_ub(ub, bh); | ||
2135 | |||
2136 | brelse(bh); | ||
2137 | |||
2138 | if (error) | ||
2139 | break; | ||
2140 | } | ||
2141 | |||
2142 | return error; | ||
2143 | } | ||
2144 | |||
2145 | /** | ||
2146 | * gfs2_get_dir_meta - return all the leaf blocks of a directory | ||
2147 | * @dip: the directory | ||
2148 | * @ub: the structure representing the meta | ||
2149 | * | ||
2150 | * Returns: errno | ||
2151 | */ | ||
2152 | |||
2153 | int gfs2_get_dir_meta(struct gfs2_inode *dip, struct gfs2_user_buffer *ub) | ||
2154 | { | ||
2155 | return foreach_leaf(dip, do_gdm, ub); | ||
2156 | } | ||
2157 | |||
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h index 79f77aab4264..ff6d1c597ee9 100644 --- a/fs/gfs2/dir.h +++ b/fs/gfs2/dir.h | |||
@@ -46,6 +46,4 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip); | |||
46 | int gfs2_diradd_alloc_required(struct gfs2_inode *dip, struct qstr *filename, | 46 | int gfs2_diradd_alloc_required(struct gfs2_inode *dip, struct qstr *filename, |
47 | int *alloc_required); | 47 | int *alloc_required); |
48 | 48 | ||
49 | int gfs2_get_dir_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub); | ||
50 | |||
51 | #endif /* __DIR_DOT_H__ */ | 49 | #endif /* __DIR_DOT_H__ */ |
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index 63a5cf1e2472..dec55dcb9dbc 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c | |||
@@ -1561,60 +1561,3 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip) | |||
1561 | return error; | 1561 | return error; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | /** | ||
1565 | * gfs2_get_eattr_meta - return all the eattr blocks of a file | ||
1566 | * @dip: the directory | ||
1567 | * @ub: the structure representing the user buffer to copy to | ||
1568 | * | ||
1569 | * Returns: errno | ||
1570 | */ | ||
1571 | |||
1572 | int gfs2_get_eattr_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub) | ||
1573 | { | ||
1574 | struct buffer_head *bh; | ||
1575 | int error; | ||
1576 | |||
1577 | error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, | ||
1578 | DIO_START | DIO_WAIT, &bh); | ||
1579 | if (error) | ||
1580 | return error; | ||
1581 | |||
1582 | gfs2_add_bh_to_ub(ub, bh); | ||
1583 | |||
1584 | if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { | ||
1585 | struct buffer_head *eabh; | ||
1586 | uint64_t *eablk, *end; | ||
1587 | |||
1588 | if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_IN)) { | ||
1589 | error = -EIO; | ||
1590 | goto out; | ||
1591 | } | ||
1592 | |||
1593 | eablk = (uint64_t *)(bh->b_data + | ||
1594 | sizeof(struct gfs2_meta_header)); | ||
1595 | end = eablk + ip->i_sbd->sd_inptrs; | ||
1596 | |||
1597 | for (; eablk < end; eablk++) { | ||
1598 | uint64_t bn; | ||
1599 | |||
1600 | if (!*eablk) | ||
1601 | break; | ||
1602 | bn = be64_to_cpu(*eablk); | ||
1603 | |||
1604 | error = gfs2_meta_read(ip->i_gl, bn, | ||
1605 | DIO_START | DIO_WAIT, &eabh); | ||
1606 | if (error) | ||
1607 | break; | ||
1608 | gfs2_add_bh_to_ub(ub, eabh); | ||
1609 | brelse(eabh); | ||
1610 | if (error) | ||
1611 | break; | ||
1612 | } | ||
1613 | } | ||
1614 | |||
1615 | out: | ||
1616 | brelse(bh); | ||
1617 | |||
1618 | return error; | ||
1619 | } | ||
1620 | |||
diff --git a/fs/gfs2/eattr.h b/fs/gfs2/eattr.h index a64039295759..e5a42abf68a3 100644 --- a/fs/gfs2/eattr.h +++ b/fs/gfs2/eattr.h | |||
@@ -74,8 +74,6 @@ int gfs2_ea_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er); | |||
74 | 74 | ||
75 | int gfs2_ea_dealloc(struct gfs2_inode *ip); | 75 | int gfs2_ea_dealloc(struct gfs2_inode *ip); |
76 | 76 | ||
77 | int gfs2_get_eattr_meta(struct gfs2_inode *ip, struct gfs2_user_buffer *ub); | ||
78 | |||
79 | /* Exported to acl.c */ | 77 | /* Exported to acl.c */ |
80 | 78 | ||
81 | int gfs2_ea_find(struct gfs2_inode *ip, | 79 | int gfs2_ea_find(struct gfs2_inode *ip, |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 74e2c62f2370..ad49153c33d1 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -221,36 +221,6 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
221 | return rv; | 221 | return rv; |
222 | } | 222 | } |
223 | 223 | ||
224 | /** | ||
225 | * gfs2_add_bh_to_ub - copy a buffer up to user space | ||
226 | * @ub: the structure representing where to copy | ||
227 | * @bh: the buffer | ||
228 | * | ||
229 | * Returns: errno | ||
230 | */ | ||
231 | |||
232 | int gfs2_add_bh_to_ub(struct gfs2_user_buffer *ub, struct buffer_head *bh) | ||
233 | { | ||
234 | uint64_t blkno = bh->b_blocknr; | ||
235 | |||
236 | if (ub->ub_count + sizeof(uint64_t) + bh->b_size > ub->ub_size) | ||
237 | return -ENOMEM; | ||
238 | |||
239 | if (copy_to_user(ub->ub_data + ub->ub_count, | ||
240 | &blkno, | ||
241 | sizeof(uint64_t))) | ||
242 | return -EFAULT; | ||
243 | ub->ub_count += sizeof(uint64_t); | ||
244 | |||
245 | if (copy_to_user(ub->ub_data + ub->ub_count, | ||
246 | bh->b_data, | ||
247 | bh->b_size)) | ||
248 | return -EFAULT; | ||
249 | ub->ub_count += bh->b_size; | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap, | 224 | void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap, |
255 | unsigned int bit, int new_value) | 225 | unsigned int bit, int new_value) |
256 | { | 226 | { |
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h index 21466fe9bf43..8d6eba3bdf0a 100644 --- a/fs/gfs2/util.h +++ b/fs/gfs2/util.h | |||
@@ -152,14 +152,6 @@ extern kmem_cache_t *gfs2_glock_cachep; | |||
152 | extern kmem_cache_t *gfs2_inode_cachep; | 152 | extern kmem_cache_t *gfs2_inode_cachep; |
153 | extern kmem_cache_t *gfs2_bufdata_cachep; | 153 | extern kmem_cache_t *gfs2_bufdata_cachep; |
154 | 154 | ||
155 | struct gfs2_user_buffer { | ||
156 | char __user *ub_data; | ||
157 | unsigned int ub_size; | ||
158 | unsigned int ub_count; | ||
159 | }; | ||
160 | |||
161 | int gfs2_add_bh_to_ub(struct gfs2_user_buffer *ub, struct buffer_head *bh); | ||
162 | |||
163 | static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt, | 155 | static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt, |
164 | unsigned int *p) | 156 | unsigned int *p) |
165 | { | 157 | { |