@@ -150,26 +150,6 @@ struct pnfs_layoutdriver_type {
150
150
const struct nfs_pageio_ops * pg_write_ops ;
151
151
152
152
struct pnfs_ds_commit_info * (* get_ds_info ) (struct inode * inode );
153
- void (* setup_ds_info )(struct pnfs_ds_commit_info * ,
154
- struct pnfs_layout_segment * );
155
- void (* release_ds_info )(struct pnfs_ds_commit_info * ,
156
- struct inode * inode );
157
- void (* mark_request_commit ) (struct nfs_page * req ,
158
- struct pnfs_layout_segment * lseg ,
159
- struct nfs_commit_info * cinfo ,
160
- u32 ds_commit_idx );
161
- void (* clear_request_commit ) (struct nfs_page * req ,
162
- struct nfs_commit_info * cinfo );
163
- int (* scan_commit_lists ) (struct nfs_commit_info * cinfo ,
164
- int max );
165
- void (* recover_commit_reqs ) (struct list_head * list ,
166
- struct nfs_commit_info * cinfo );
167
- struct nfs_page * (* search_commit_reqs )(struct nfs_commit_info * cinfo ,
168
- struct page * page );
169
- int (* commit_pagelist )(struct inode * inode ,
170
- struct list_head * mds_pages ,
171
- int how ,
172
- struct nfs_commit_info * cinfo );
173
153
174
154
int (* sync )(struct inode * inode , bool datasync );
175
155
@@ -192,6 +172,29 @@ struct pnfs_layoutdriver_type {
192
172
int (* prepare_layoutstats ) (struct nfs42_layoutstat_args * args );
193
173
};
194
174
175
+ struct pnfs_commit_ops {
176
+ void (* setup_ds_info )(struct pnfs_ds_commit_info * ,
177
+ struct pnfs_layout_segment * );
178
+ void (* release_ds_info )(struct pnfs_ds_commit_info * ,
179
+ struct inode * inode );
180
+ int (* commit_pagelist )(struct inode * inode ,
181
+ struct list_head * mds_pages ,
182
+ int how ,
183
+ struct nfs_commit_info * cinfo );
184
+ void (* mark_request_commit ) (struct nfs_page * req ,
185
+ struct pnfs_layout_segment * lseg ,
186
+ struct nfs_commit_info * cinfo ,
187
+ u32 ds_commit_idx );
188
+ void (* clear_request_commit ) (struct nfs_page * req ,
189
+ struct nfs_commit_info * cinfo );
190
+ int (* scan_commit_lists ) (struct nfs_commit_info * cinfo ,
191
+ int max );
192
+ void (* recover_commit_reqs ) (struct list_head * list ,
193
+ struct nfs_commit_info * cinfo );
194
+ struct nfs_page * (* search_commit_reqs )(struct nfs_commit_info * cinfo ,
195
+ struct page * page );
196
+ };
197
+
195
198
struct pnfs_layout_hdr {
196
199
refcount_t plh_refcount ;
197
200
atomic_t plh_outstanding ; /* number of RPCs out */
@@ -461,9 +464,11 @@ static inline int
461
464
pnfs_commit_list (struct inode * inode , struct list_head * mds_pages , int how ,
462
465
struct nfs_commit_info * cinfo )
463
466
{
464
- if (cinfo -> ds == NULL || cinfo -> ds -> ncommitting == 0 )
467
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
468
+
469
+ if (fl_cinfo == NULL || fl_cinfo -> ncommitting == 0 )
465
470
return PNFS_NOT_ATTEMPTED ;
466
- return NFS_SERVER ( inode ) -> pnfs_curr_ld -> commit_pagelist (inode , mds_pages , how , cinfo );
471
+ return fl_cinfo -> ops -> commit_pagelist (inode , mds_pages , how , cinfo );
467
472
}
468
473
469
474
static inline struct pnfs_ds_commit_info *
@@ -476,19 +481,26 @@ pnfs_get_ds_info(struct inode *inode)
476
481
return ld -> get_ds_info (inode );
477
482
}
478
483
484
+ static inline void
485
+ pnfs_init_ds_commit_info_ops (struct pnfs_ds_commit_info * fl_cinfo , struct inode * inode )
486
+ {
487
+ struct pnfs_ds_commit_info * inode_cinfo = pnfs_get_ds_info (inode );
488
+ if (inode_cinfo != NULL )
489
+ fl_cinfo -> ops = inode_cinfo -> ops ;
490
+ }
491
+
479
492
static inline void
480
493
pnfs_init_ds_commit_info (struct pnfs_ds_commit_info * fl_cinfo )
481
494
{
482
495
INIT_LIST_HEAD (& fl_cinfo -> commits );
496
+ fl_cinfo -> ops = NULL ;
483
497
}
484
498
485
499
static inline void
486
500
pnfs_release_ds_info (struct pnfs_ds_commit_info * fl_cinfo , struct inode * inode )
487
501
{
488
- struct pnfs_layoutdriver_type * ld = NFS_SERVER (inode )-> pnfs_curr_ld ;
489
-
490
- if (ld != NULL && ld -> release_ds_info != NULL )
491
- ld -> release_ds_info (fl_cinfo , inode );
502
+ if (fl_cinfo -> ops != NULL && fl_cinfo -> ops -> release_ds_info != NULL )
503
+ fl_cinfo -> ops -> release_ds_info (fl_cinfo , inode );
492
504
}
493
505
494
506
static inline void
@@ -501,46 +513,54 @@ static inline bool
501
513
pnfs_mark_request_commit (struct nfs_page * req , struct pnfs_layout_segment * lseg ,
502
514
struct nfs_commit_info * cinfo , u32 ds_commit_idx )
503
515
{
504
- struct inode * inode = d_inode (nfs_req_openctx (req )-> dentry );
505
- struct pnfs_layoutdriver_type * ld = NFS_SERVER (inode )-> pnfs_curr_ld ;
516
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
506
517
507
- if (lseg == NULL || ld -> mark_request_commit == NULL )
518
+ if (! lseg || ! fl_cinfo -> ops -> mark_request_commit )
508
519
return false;
509
- ld -> mark_request_commit (req , lseg , cinfo , ds_commit_idx );
520
+ fl_cinfo -> ops -> mark_request_commit (req , lseg , cinfo , ds_commit_idx );
510
521
return true;
511
522
}
512
523
513
524
static inline bool
514
525
pnfs_clear_request_commit (struct nfs_page * req , struct nfs_commit_info * cinfo )
515
526
{
516
- struct inode * inode = d_inode (nfs_req_openctx (req )-> dentry );
517
- struct pnfs_layoutdriver_type * ld = NFS_SERVER (inode )-> pnfs_curr_ld ;
527
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
518
528
519
- if (ld == NULL || ld -> clear_request_commit == NULL )
529
+ if (! fl_cinfo || ! fl_cinfo -> ops || ! fl_cinfo -> ops -> clear_request_commit )
520
530
return false;
521
- ld -> clear_request_commit (req , cinfo );
531
+ fl_cinfo -> ops -> clear_request_commit (req , cinfo );
522
532
return true;
523
533
}
524
534
525
535
static inline int
526
536
pnfs_scan_commit_lists (struct inode * inode , struct nfs_commit_info * cinfo ,
527
537
int max )
528
538
{
529
- if (cinfo -> ds == NULL || cinfo -> ds -> nwritten == 0 )
539
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
540
+
541
+ if (!fl_cinfo || fl_cinfo -> nwritten == 0 )
530
542
return 0 ;
531
- else
532
- return NFS_SERVER (inode )-> pnfs_curr_ld -> scan_commit_lists (cinfo , max );
543
+ return fl_cinfo -> ops -> scan_commit_lists (cinfo , max );
544
+ }
545
+
546
+ static inline void
547
+ pnfs_recover_commit_reqs (struct list_head * head , struct nfs_commit_info * cinfo )
548
+ {
549
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
550
+
551
+ if (fl_cinfo && fl_cinfo -> nwritten != 0 )
552
+ fl_cinfo -> ops -> recover_commit_reqs (head , cinfo );
533
553
}
534
554
535
555
static inline struct nfs_page *
536
556
pnfs_search_commit_reqs (struct inode * inode , struct nfs_commit_info * cinfo ,
537
557
struct page * page )
538
558
{
539
- struct pnfs_layoutdriver_type * ld = NFS_SERVER ( inode ) -> pnfs_curr_ld ;
559
+ struct pnfs_ds_commit_info * fl_cinfo = cinfo -> ds ;
540
560
541
- if (ld == NULL || ld -> search_commit_reqs == NULL )
561
+ if (! fl_cinfo -> ops || ! fl_cinfo -> ops -> search_commit_reqs )
542
562
return NULL ;
543
- return ld -> search_commit_reqs (cinfo , page );
563
+ return fl_cinfo -> ops -> search_commit_reqs (cinfo , page );
544
564
}
545
565
546
566
/* Should the pNFS client commit and return the layout upon a setattr */
@@ -788,6 +808,11 @@ pnfs_get_ds_info(struct inode *inode)
788
808
return NULL ;
789
809
}
790
810
811
+ static inline void
812
+ pnfs_init_ds_commit_info_ops (struct pnfs_ds_commit_info * fl_cinfo , struct inode * inode )
813
+ {
814
+ }
815
+
791
816
static inline void
792
817
pnfs_init_ds_commit_info (struct pnfs_ds_commit_info * fl_cinfo )
793
818
{
@@ -818,6 +843,11 @@ pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo,
818
843
return 0 ;
819
844
}
820
845
846
+ static inline void
847
+ pnfs_recover_commit_reqs (struct list_head * head , struct nfs_commit_info * cinfo )
848
+ {
849
+ }
850
+
821
851
static inline struct nfs_page *
822
852
pnfs_search_commit_reqs (struct inode * inode , struct nfs_commit_info * cinfo ,
823
853
struct page * page )
0 commit comments