Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

filelock: convert locks_insert_lock_ctx and locks_delete_lock_ctx

Have these functions take a file_lock_core pointer instead of a
file_lock.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240131-flsplit-v3-31-c6129007ee8d@kernel.org
Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
7c18509b 347d49fd

+22 -22
+22 -22
fs/locks.c
··· 824 824 } 825 825 826 826 static void 827 - locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before) 827 + locks_insert_lock_ctx(struct file_lock_core *fl, struct list_head *before) 828 828 { 829 - list_add_tail(&fl->c.flc_list, before); 830 - locks_insert_global_locks(&fl->c); 829 + list_add_tail(&fl->flc_list, before); 830 + locks_insert_global_locks(fl); 831 831 } 832 832 833 833 static void 834 - locks_unlink_lock_ctx(struct file_lock *fl) 834 + locks_unlink_lock_ctx(struct file_lock_core *fl) 835 835 { 836 - locks_delete_global_locks(&fl->c); 837 - list_del_init(&fl->c.flc_list); 838 - locks_wake_up_blocks(&fl->c); 836 + locks_delete_global_locks(fl); 837 + list_del_init(&fl->flc_list); 838 + locks_wake_up_blocks(fl); 839 839 } 840 840 841 841 static void 842 - locks_delete_lock_ctx(struct file_lock *fl, struct list_head *dispose) 842 + locks_delete_lock_ctx(struct file_lock_core *fl, struct list_head *dispose) 843 843 { 844 844 locks_unlink_lock_ctx(fl); 845 845 if (dispose) 846 - list_add(&fl->c.flc_list, dispose); 846 + list_add(&fl->flc_list, dispose); 847 847 else 848 - locks_free_lock(fl); 848 + locks_free_lock(file_lock(fl)); 849 849 } 850 850 851 851 /* Determine if lock sys_fl blocks lock caller_fl. Common functionality ··· 1072 1072 if (request->c.flc_type == fl->c.flc_type) 1073 1073 goto out; 1074 1074 found = true; 1075 - locks_delete_lock_ctx(fl, &dispose); 1075 + locks_delete_lock_ctx(&fl->c, &dispose); 1076 1076 break; 1077 1077 } 1078 1078 ··· 1097 1097 goto out; 1098 1098 locks_copy_lock(new_fl, request); 1099 1099 locks_move_blocks(new_fl, request); 1100 - locks_insert_lock_ctx(new_fl, &ctx->flc_flock); 1100 + locks_insert_lock_ctx(&new_fl->c, &ctx->flc_flock); 1101 1101 new_fl = NULL; 1102 1102 error = 0; 1103 1103 ··· 1236 1236 else 1237 1237 request->fl_end = fl->fl_end; 1238 1238 if (added) { 1239 - locks_delete_lock_ctx(fl, &dispose); 1239 + locks_delete_lock_ctx(&fl->c, &dispose); 1240 1240 continue; 1241 1241 } 1242 1242 request = fl; ··· 1265 1265 * one (This may happen several times). 1266 1266 */ 1267 1267 if (added) { 1268 - locks_delete_lock_ctx(fl, &dispose); 1268 + locks_delete_lock_ctx(&fl->c, &dispose); 1269 1269 continue; 1270 1270 } 1271 1271 /* ··· 1282 1282 locks_move_blocks(new_fl, request); 1283 1283 request = new_fl; 1284 1284 new_fl = NULL; 1285 - locks_insert_lock_ctx(request, 1285 + locks_insert_lock_ctx(&request->c, 1286 1286 &fl->c.flc_list); 1287 - locks_delete_lock_ctx(fl, &dispose); 1287 + locks_delete_lock_ctx(&fl->c, &dispose); 1288 1288 added = true; 1289 1289 } 1290 1290 } ··· 1313 1313 } 1314 1314 locks_copy_lock(new_fl, request); 1315 1315 locks_move_blocks(new_fl, request); 1316 - locks_insert_lock_ctx(new_fl, &fl->c.flc_list); 1316 + locks_insert_lock_ctx(&new_fl->c, &fl->c.flc_list); 1317 1317 fl = new_fl; 1318 1318 new_fl = NULL; 1319 1319 } ··· 1325 1325 left = new_fl2; 1326 1326 new_fl2 = NULL; 1327 1327 locks_copy_lock(left, right); 1328 - locks_insert_lock_ctx(left, &fl->c.flc_list); 1328 + locks_insert_lock_ctx(&left->c, &fl->c.flc_list); 1329 1329 } 1330 1330 right->fl_start = request->fl_end + 1; 1331 1331 locks_wake_up_blocks(&right->c); ··· 1425 1425 printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync); 1426 1426 fl->fl_fasync = NULL; 1427 1427 } 1428 - locks_delete_lock_ctx(fl, dispose); 1428 + locks_delete_lock_ctx(&fl->c, dispose); 1429 1429 } 1430 1430 return 0; 1431 1431 } ··· 1558 1558 fl->fl_downgrade_time = break_time; 1559 1559 } 1560 1560 if (fl->fl_lmops->lm_break(fl)) 1561 - locks_delete_lock_ctx(fl, &dispose); 1561 + locks_delete_lock_ctx(&fl->c, &dispose); 1562 1562 } 1563 1563 1564 1564 if (list_empty(&ctx->flc_lease)) ··· 1816 1816 if (!leases_enable) 1817 1817 goto out; 1818 1818 1819 - locks_insert_lock_ctx(lease, &ctx->flc_lease); 1819 + locks_insert_lock_ctx(&lease->c, &ctx->flc_lease); 1820 1820 /* 1821 1821 * The check in break_lease() is lockless. It's possible for another 1822 1822 * open to race in after we did the earlier check for a conflicting ··· 1829 1829 smp_mb(); 1830 1830 error = check_conflicting_open(filp, arg, lease->c.flc_flags); 1831 1831 if (error) { 1832 - locks_unlink_lock_ctx(lease); 1832 + locks_unlink_lock_ctx(&lease->c); 1833 1833 goto out; 1834 1834 } 1835 1835