aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index ea9ca239c878..ce7f83306909 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1234,92 +1234,6 @@ fail:
1234 return error; 1234 return error;
1235} 1235}
1236 1236
1237/**
1238 * glock_compare_atime - Compare two struct gfs2_glock structures for sort
1239 * @arg_a: the first structure
1240 * @arg_b: the second structure
1241 *
1242 * Returns: 1 if A > B
1243 * -1 if A < B
1244 * 0 if A == B
1245 */
1246
1247static int glock_compare_atime(const void *arg_a, const void *arg_b)
1248{
1249 const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
1250 const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
1251 const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
1252 const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
1253
1254 if (a->ln_number > b->ln_number)
1255 return 1;
1256 if (a->ln_number < b->ln_number)
1257 return -1;
1258 if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
1259 return 1;
1260 if (gh_a->gh_state == LM_ST_SHARED && (gh_b->gh_flags & GL_ATIME))
1261 return 1;
1262
1263 return 0;
1264}
1265
1266/**
1267 * gfs2_glock_nq_m_atime - acquire multiple glocks where one may need an
1268 * atime update
1269 * @num_gh: the number of structures
1270 * @ghs: an array of struct gfs2_holder structures
1271 *
1272 * Returns: 0 on success (all glocks acquired),
1273 * errno on failure (no glocks acquired)
1274 */
1275
1276int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs)
1277{
1278 struct gfs2_holder **p;
1279 unsigned int x;
1280 int error = 0;
1281
1282 if (!num_gh)
1283 return 0;
1284
1285 if (num_gh == 1) {
1286 ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
1287 if (ghs->gh_flags & GL_ATIME)
1288 error = gfs2_glock_nq_atime(ghs);
1289 else
1290 error = gfs2_glock_nq(ghs);
1291 return error;
1292 }
1293
1294 p = kcalloc(num_gh, sizeof(struct gfs2_holder *), GFP_KERNEL);
1295 if (!p)
1296 return -ENOMEM;
1297
1298 for (x = 0; x < num_gh; x++)
1299 p[x] = &ghs[x];
1300
1301 sort(p, num_gh, sizeof(struct gfs2_holder *), glock_compare_atime,NULL);
1302
1303 for (x = 0; x < num_gh; x++) {
1304 p[x]->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
1305
1306 if (p[x]->gh_flags & GL_ATIME)
1307 error = gfs2_glock_nq_atime(p[x]);
1308 else
1309 error = gfs2_glock_nq(p[x]);
1310
1311 if (error) {
1312 while (x--)
1313 gfs2_glock_dq(p[x]);
1314 break;
1315 }
1316 }
1317
1318 kfree(p);
1319 return error;
1320}
1321
1322
1323static int 1237static int
1324__gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr) 1238__gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1325{ 1239{