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

Configure Feed

Select the types of activity you want to include in your feed.

NFS: Move sequence slot operations into minorversion operations

At the same time, I move the NFS v4.0 functions into nfs40proc.c to keep
v4.0 features together in their own files.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

+70 -72
+30
fs/nfs/nfs40proc.c
··· 6 6 #include "internal.h" 7 7 #include "nfs4_fs.h" 8 8 #include "nfs40.h" 9 + #include "nfs4session.h" 9 10 #include "nfs4trace.h" 10 11 11 12 static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata) ··· 20 19 { 21 20 struct nfs4_call_sync_data *data = calldata; 22 21 nfs4_sequence_done(task, data->seq_res); 22 + } 23 + 24 + static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res) 25 + { 26 + struct nfs4_slot *slot = res->sr_slot; 27 + struct nfs4_slot_table *tbl; 28 + 29 + tbl = slot->table; 30 + spin_lock(&tbl->slot_tbl_lock); 31 + if (!nfs41_wake_and_assign_slot(tbl, slot)) 32 + nfs4_free_slot(tbl, slot); 33 + spin_unlock(&tbl->slot_tbl_lock); 34 + 35 + res->sr_slot = NULL; 36 + } 37 + 38 + static int nfs40_sequence_done(struct rpc_task *task, 39 + struct nfs4_sequence_res *res) 40 + { 41 + if (res->sr_slot != NULL) 42 + nfs40_sequence_free_slot(res); 43 + return 1; 23 44 } 24 45 25 46 static void nfs40_clear_delegation_stateid(struct nfs4_state *state) ··· 340 317 .rpc_call_done = nfs40_call_sync_done, 341 318 }; 342 319 320 + static const struct nfs4_sequence_slot_ops nfs40_sequence_slot_ops = { 321 + .process = nfs40_sequence_done, 322 + .done = nfs40_sequence_done, 323 + .free_slot = nfs40_sequence_free_slot, 324 + }; 325 + 343 326 static const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = { 344 327 .owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT, 345 328 .state_flag_bit = NFS_STATE_RECLAIM_REBOOT, ··· 387 358 .test_and_free_expired = nfs40_test_and_free_expired_stateid, 388 359 .alloc_seqid = nfs_alloc_seqid, 389 360 .call_sync_ops = &nfs40_call_sync_ops, 361 + .sequence_slot_ops = &nfs40_sequence_slot_ops, 390 362 .reboot_recovery_ops = &nfs40_reboot_recovery_ops, 391 363 .nograce_recovery_ops = &nfs40_nograce_recovery_ops, 392 364 .state_renewal_ops = &nfs40_state_renewal_ops,
+7 -1
fs/nfs/nfs4_fs.h
··· 73 73 void (*session_trunk)(struct rpc_clnt *clnt, 74 74 struct rpc_xprt *xprt, void *data); 75 75 const struct rpc_call_ops *call_sync_ops; 76 + const struct nfs4_sequence_slot_ops *sequence_slot_ops; 76 77 const struct nfs4_state_recovery_ops *reboot_recovery_ops; 77 78 const struct nfs4_state_recovery_ops *nograce_recovery_ops; 78 79 const struct nfs4_state_maintenance_ops *state_renewal_ops; ··· 257 256 const struct cred *cred; 258 257 }; 259 258 259 + struct nfs4_sequence_slot_ops { 260 + int (*process)(struct rpc_task *, struct nfs4_sequence_res *); 261 + int (*done)(struct rpc_task *, struct nfs4_sequence_res *); 262 + void (*free_slot)(struct nfs4_sequence_res *); 263 + }; 264 + 260 265 struct nfs4_state_maintenance_ops { 261 266 int (*sched_state_renewal)(struct nfs_client *, const struct cred *, unsigned); 262 267 const struct cred * (*get_state_renewal_cred)(struct nfs_client *); ··· 318 311 struct nfs4_sequence_res *res); 319 312 extern void nfs4_init_sequence(struct nfs_client *clp, struct nfs4_sequence_args *, 320 313 struct nfs4_sequence_res *, int, int); 321 - extern int nfs40_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res); 322 314 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *); 323 315 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *); 324 316 extern void renew_lease(const struct nfs_server *server, unsigned long timestamp);
+32 -71
fs/nfs/nfs4proc.c
··· 780 780 args->sa_privileged = privileged; 781 781 782 782 res->sr_slot = NULL; 783 - } 784 - 785 - static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res) 786 - { 787 - struct nfs4_slot *slot = res->sr_slot; 788 - struct nfs4_slot_table *tbl; 789 - 790 - tbl = slot->table; 791 - spin_lock(&tbl->slot_tbl_lock); 792 - if (!nfs41_wake_and_assign_slot(tbl, slot)) 793 - nfs4_free_slot(tbl, slot); 794 - spin_unlock(&tbl->slot_tbl_lock); 795 - 796 - res->sr_slot = NULL; 797 - } 798 - 799 - int nfs40_sequence_done(struct rpc_task *task, 800 - struct nfs4_sequence_res *res) 801 - { 802 - if (res->sr_slot != NULL) 803 - nfs40_sequence_free_slot(res); 804 - return 1; 783 + res->sr_slot_ops = clp->cl_mvops->sequence_slot_ops; 805 784 } 806 785 807 786 #if defined(CONFIG_NFS_V4_1) ··· 999 1020 } 1000 1021 EXPORT_SYMBOL_GPL(nfs41_sequence_done); 1001 1022 1002 - static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res) 1003 - { 1004 - if (res->sr_slot == NULL) 1005 - return 1; 1006 - if (res->sr_slot->table->session != NULL) 1007 - return nfs41_sequence_process(task, res); 1008 - return nfs40_sequence_done(task, res); 1009 - } 1010 - 1011 - static void nfs4_sequence_free_slot(struct nfs4_sequence_res *res) 1012 - { 1013 - if (res->sr_slot != NULL) { 1014 - if (res->sr_slot->table->session != NULL) 1015 - nfs41_sequence_free_slot(res); 1016 - else 1017 - nfs40_sequence_free_slot(res); 1018 - } 1019 - } 1020 - 1021 - int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 1022 - { 1023 - if (res->sr_slot == NULL) 1024 - return 1; 1025 - if (!res->sr_slot->table->session) 1026 - return nfs40_sequence_done(task, res); 1027 - return nfs41_sequence_done(task, res); 1028 - } 1029 - EXPORT_SYMBOL_GPL(nfs4_sequence_done); 1030 - 1031 1023 static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) 1032 1024 { 1033 1025 struct nfs4_call_sync_data *data = calldata; ··· 1021 1071 .rpc_call_done = nfs41_call_sync_done, 1022 1072 }; 1023 1073 1024 - #else /* !CONFIG_NFS_V4_1 */ 1025 - 1026 - static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res) 1027 - { 1028 - return nfs40_sequence_done(task, res); 1029 - } 1030 - 1031 - static void nfs4_sequence_free_slot(struct nfs4_sequence_res *res) 1032 - { 1033 - if (res->sr_slot != NULL) 1034 - nfs40_sequence_free_slot(res); 1035 - } 1036 - 1037 - int nfs4_sequence_done(struct rpc_task *task, 1038 - struct nfs4_sequence_res *res) 1039 - { 1040 - return nfs40_sequence_done(task, res); 1041 - } 1042 - EXPORT_SYMBOL_GPL(nfs4_sequence_done); 1043 1074 1044 1075 #endif /* !CONFIG_NFS_V4_1 */ 1045 1076 ··· 1043 1112 1044 1113 res->sr_slot = slot; 1045 1114 } 1115 + 1116 + static void nfs4_sequence_free_slot(struct nfs4_sequence_res *res) 1117 + { 1118 + if (res->sr_slot != NULL) 1119 + res->sr_slot_ops->free_slot(res); 1120 + } 1121 + 1122 + static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res) 1123 + { 1124 + if (res->sr_slot == NULL) 1125 + return 1; 1126 + return res->sr_slot_ops->process(task, res); 1127 + } 1128 + 1129 + int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) 1130 + { 1131 + if (res->sr_slot == NULL) 1132 + return 1; 1133 + return res->sr_slot_ops->done(task, res); 1134 + } 1135 + EXPORT_SYMBOL_GPL(nfs4_sequence_done); 1136 + 1046 1137 1047 1138 int nfs4_setup_sequence(struct nfs_client *client, 1048 1139 struct nfs4_sequence_args *args, ··· 2400 2447 { 2401 2448 struct nfs4_opendata *data = calldata; 2402 2449 2403 - nfs40_sequence_done(task, &data->c_res.seq_res); 2450 + data->c_res.seq_res.sr_slot_ops->done(task, &data->c_res.seq_res); 2404 2451 2405 2452 data->rpc_status = task->tk_status; 2406 2453 if (data->rpc_status == 0) { ··· 10482 10529 10483 10530 10484 10531 #if defined(CONFIG_NFS_V4_1) 10532 + static const struct nfs4_sequence_slot_ops nfs41_sequence_slot_ops = { 10533 + .process = nfs41_sequence_process, 10534 + .done = nfs41_sequence_done, 10535 + .free_slot = nfs41_sequence_free_slot, 10536 + }; 10537 + 10485 10538 static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = { 10486 10539 .owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT, 10487 10540 .state_flag_bit = NFS_STATE_RECLAIM_REBOOT, ··· 10542 10583 .alloc_seqid = nfs_alloc_no_seqid, 10543 10584 .session_trunk = nfs4_test_session_trunk, 10544 10585 .call_sync_ops = &nfs41_call_sync_ops, 10586 + .sequence_slot_ops = &nfs41_sequence_slot_ops, 10545 10587 .reboot_recovery_ops = &nfs41_reboot_recovery_ops, 10546 10588 .nograce_recovery_ops = &nfs41_nograce_recovery_ops, 10547 10589 .state_renewal_ops = &nfs41_state_renewal_ops, ··· 10579 10619 .find_root_sec = nfs41_find_root_sec, 10580 10620 .free_lock_state = nfs41_free_lock_state, 10581 10621 .call_sync_ops = &nfs41_call_sync_ops, 10622 + .sequence_slot_ops = &nfs41_sequence_slot_ops, 10582 10623 .test_and_free_expired = nfs41_test_and_free_expired_stateid, 10583 10624 .alloc_seqid = nfs_alloc_no_seqid, 10584 10625 .session_trunk = nfs4_test_session_trunk,
+1
include/linux/nfs_xdr.h
··· 209 209 }; 210 210 211 211 struct nfs4_sequence_res { 212 + const struct nfs4_sequence_slot_ops *sr_slot_ops; 212 213 struct nfs4_slot *sr_slot; /* slot used to send request */ 213 214 unsigned long sr_timestamp; 214 215 int sr_status; /* sequence operation status */