aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/bmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r--fs/gfs2/bmap.c81
1 files changed, 1 insertions, 80 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
1143static 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
1187int 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