aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlmglue.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-10-18 18:23:46 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2008-01-25 17:45:57 -0500
commitc934a92d05b549dd2f25db72c5fc3cb9dcf1b611 (patch)
tree57150c87d1d465db28fceaa14c9d5b220c7a3954 /fs/ocfs2/dlmglue.c
parentf1f540688eae66c274ff1c1133b5d9c687b28f58 (diff)
ocfs2: Remove data locks
The meta lock now covers both meta data and data, so this just removes the now-redundant data lock. Combining locks saves us a round of lock mastery per inode and one less lock to ping between nodes during read/write. We don't lose much - since meta locks were always held before a data lock (and at the same level) ordered writeout mode (the default) ensured that flushing for the meta data lock also pushed out data anyways. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r--fs/ocfs2/dlmglue.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 7e36abea8f40..ecf58c6e2fa3 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -232,12 +232,6 @@ static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
232 .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB, 232 .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
233}; 233};
234 234
235static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
236 .get_osb = ocfs2_get_inode_osb,
237 .downconvert_worker = ocfs2_data_convert_worker,
238 .flags = 0,
239};
240
241static struct ocfs2_lock_res_ops ocfs2_super_lops = { 235static struct ocfs2_lock_res_ops ocfs2_super_lops = {
242 .flags = LOCK_TYPE_REQUIRES_REFRESH, 236 .flags = LOCK_TYPE_REQUIRES_REFRESH,
243}; 237};
@@ -261,7 +255,6 @@ static struct ocfs2_lock_res_ops ocfs2_inode_open_lops = {
261static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) 255static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
262{ 256{
263 return lockres->l_type == OCFS2_LOCK_TYPE_META || 257 return lockres->l_type == OCFS2_LOCK_TYPE_META ||
264 lockres->l_type == OCFS2_LOCK_TYPE_DATA ||
265 lockres->l_type == OCFS2_LOCK_TYPE_RW || 258 lockres->l_type == OCFS2_LOCK_TYPE_RW ||
266 lockres->l_type == OCFS2_LOCK_TYPE_OPEN; 259 lockres->l_type == OCFS2_LOCK_TYPE_OPEN;
267} 260}
@@ -405,9 +398,6 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
405 case OCFS2_LOCK_TYPE_META: 398 case OCFS2_LOCK_TYPE_META:
406 ops = &ocfs2_inode_meta_lops; 399 ops = &ocfs2_inode_meta_lops;
407 break; 400 break;
408 case OCFS2_LOCK_TYPE_DATA:
409 ops = &ocfs2_inode_data_lops;
410 break;
411 case OCFS2_LOCK_TYPE_OPEN: 401 case OCFS2_LOCK_TYPE_OPEN:
412 ops = &ocfs2_inode_open_lops; 402 ops = &ocfs2_inode_open_lops;
413 break; 403 break;
@@ -1154,12 +1144,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode)
1154 goto bail; 1144 goto bail;
1155 } 1145 }
1156 1146
1157 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_data_lockres, 1, 1);
1158 if (ret) {
1159 mlog_errno(ret);
1160 goto bail;
1161 }
1162
1163 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0); 1147 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0);
1164 if (ret) { 1148 if (ret) {
1165 mlog_errno(ret); 1149 mlog_errno(ret);
@@ -1312,67 +1296,6 @@ out:
1312 mlog_exit_void(); 1296 mlog_exit_void();
1313} 1297}
1314 1298
1315int ocfs2_data_lock_full(struct inode *inode,
1316 int write,
1317 int arg_flags)
1318{
1319 int status = 0, level;
1320 struct ocfs2_lock_res *lockres;
1321 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1322
1323 BUG_ON(!inode);
1324
1325 mlog_entry_void();
1326
1327 mlog(0, "inode %llu take %s DATA lock\n",
1328 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1329 write ? "EXMODE" : "PRMODE");
1330
1331 /* We'll allow faking a readonly data lock for
1332 * rodevices. */
1333 if (ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) {
1334 if (write) {
1335 status = -EROFS;
1336 mlog_errno(status);
1337 }
1338 goto out;
1339 }
1340
1341 if (ocfs2_mount_local(osb))
1342 goto out;
1343
1344 lockres = &OCFS2_I(inode)->ip_data_lockres;
1345
1346 level = write ? LKM_EXMODE : LKM_PRMODE;
1347
1348 status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level,
1349 0, arg_flags);
1350 if (status < 0 && status != -EAGAIN)
1351 mlog_errno(status);
1352
1353out:
1354 mlog_exit(status);
1355 return status;
1356}
1357
1358/* see ocfs2_meta_lock_with_page() */
1359int ocfs2_data_lock_with_page(struct inode *inode,
1360 int write,
1361 struct page *page)
1362{
1363 int ret;
1364
1365 ret = ocfs2_data_lock_full(inode, write, OCFS2_LOCK_NONBLOCK);
1366 if (ret == -EAGAIN) {
1367 unlock_page(page);
1368 if (ocfs2_data_lock(inode, write) == 0)
1369 ocfs2_data_unlock(inode, write);
1370 ret = AOP_TRUNCATED_PAGE;
1371 }
1372
1373 return ret;
1374}
1375
1376static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, 1299static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
1377 struct ocfs2_lock_res *lockres) 1300 struct ocfs2_lock_res *lockres)
1378{ 1301{
@@ -1404,26 +1327,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
1404 mlog_exit_void(); 1327 mlog_exit_void();
1405} 1328}
1406 1329
1407void ocfs2_data_unlock(struct inode *inode,
1408 int write)
1409{
1410 int level = write ? LKM_EXMODE : LKM_PRMODE;
1411 struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres;
1412 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1413
1414 mlog_entry_void();
1415
1416 mlog(0, "inode %llu drop %s DATA lock\n",
1417 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1418 write ? "EXMODE" : "PRMODE");
1419
1420 if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) &&
1421 !ocfs2_mount_local(osb))
1422 ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
1423
1424 mlog_exit_void();
1425}
1426
1427#define OCFS2_SEC_BITS 34 1330#define OCFS2_SEC_BITS 34
1428#define OCFS2_SEC_SHIFT (64 - 34) 1331#define OCFS2_SEC_SHIFT (64 - 34)
1429#define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1) 1332#define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1)
@@ -2592,13 +2495,6 @@ int ocfs2_drop_inode_locks(struct inode *inode)
2592 status = err; 2495 status = err;
2593 2496
2594 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb), 2497 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
2595 &OCFS2_I(inode)->ip_data_lockres);
2596 if (err < 0)
2597 mlog_errno(err);
2598 if (err < 0 && !status)
2599 status = err;
2600
2601 err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
2602 &OCFS2_I(inode)->ip_meta_lockres); 2498 &OCFS2_I(inode)->ip_meta_lockres);
2603 if (err < 0) 2499 if (err < 0)
2604 mlog_errno(err); 2500 mlog_errno(err);