@@ -225,11 +225,11 @@ nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr)
225225}
226226
227227static struct nfs4_pnfs_ds *
228- nfs4_pnfs_ds_add (struct inode * inode , u32 ip_addr , u32 port )
228+ nfs4_pnfs_ds_add (struct inode * inode , u32 ip_addr , u32 port , gfp_t gfp_flags )
229229{
230230 struct nfs4_pnfs_ds * tmp_ds , * ds ;
231231
232- ds = kzalloc (sizeof (* tmp_ds ), GFP_KERNEL );
232+ ds = kzalloc (sizeof (* tmp_ds ), gfp_flags );
233233 if (!ds )
234234 goto out ;
235235
@@ -261,7 +261,7 @@ nfs4_pnfs_ds_add(struct inode *inode, u32 ip_addr, u32 port)
261261 * Currently only support ipv4, and one multi-path address.
262262 */
263263static struct nfs4_pnfs_ds *
264- decode_and_add_ds (struct xdr_stream * streamp , struct inode * inode )
264+ decode_and_add_ds (struct xdr_stream * streamp , struct inode * inode , gfp_t gfp_flags )
265265{
266266 struct nfs4_pnfs_ds * ds = NULL ;
267267 char * buf ;
@@ -303,7 +303,7 @@ decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode)
303303 rlen );
304304 goto out_err ;
305305 }
306- buf = kmalloc (rlen + 1 , GFP_KERNEL );
306+ buf = kmalloc (rlen + 1 , gfp_flags );
307307 if (!buf ) {
308308 dprintk ("%s: Not enough memory\n" , __func__ );
309309 goto out_err ;
@@ -333,7 +333,7 @@ decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode)
333333 sscanf (pstr , "-%d-%d" , & tmp [0 ], & tmp [1 ]);
334334 port = htons ((tmp [0 ] << 8 ) | (tmp [1 ]));
335335
336- ds = nfs4_pnfs_ds_add (inode , ip_addr , port );
336+ ds = nfs4_pnfs_ds_add (inode , ip_addr , port , gfp_flags );
337337 dprintk ("%s: Decoded address and port %s\n" , __func__ , buf );
338338out_free :
339339 kfree (buf );
@@ -343,7 +343,7 @@ decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode)
343343
344344/* Decode opaque device data and return the result */
345345static struct nfs4_file_layout_dsaddr *
346- decode_device (struct inode * ino , struct pnfs_device * pdev )
346+ decode_device (struct inode * ino , struct pnfs_device * pdev , gfp_t gfp_flags )
347347{
348348 int i ;
349349 u32 cnt , num ;
@@ -362,7 +362,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev)
362362 struct page * scratch ;
363363
364364 /* set up xdr stream */
365- scratch = alloc_page (GFP_KERNEL );
365+ scratch = alloc_page (gfp_flags );
366366 if (!scratch )
367367 goto out_err ;
368368
@@ -384,7 +384,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev)
384384 }
385385
386386 /* read stripe indices */
387- stripe_indices = kcalloc (cnt , sizeof (u8 ), GFP_KERNEL );
387+ stripe_indices = kcalloc (cnt , sizeof (u8 ), gfp_flags );
388388 if (!stripe_indices )
389389 goto out_err_free_scratch ;
390390
@@ -423,7 +423,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev)
423423
424424 dsaddr = kzalloc (sizeof (* dsaddr ) +
425425 (sizeof (struct nfs4_pnfs_ds * ) * (num - 1 )),
426- GFP_KERNEL );
426+ gfp_flags );
427427 if (!dsaddr )
428428 goto out_err_free_stripe_indices ;
429429
@@ -452,7 +452,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev)
452452 for (j = 0 ; j < mp_count ; j ++ ) {
453453 if (j == 0 ) {
454454 dsaddr -> ds_list [i ] = decode_and_add_ds (& stream ,
455- ino );
455+ ino , gfp_flags );
456456 if (dsaddr -> ds_list [i ] == NULL )
457457 goto out_err_free_deviceid ;
458458 } else {
@@ -503,12 +503,12 @@ decode_device(struct inode *ino, struct pnfs_device *pdev)
503503 * available devices.
504504 */
505505static struct nfs4_file_layout_dsaddr *
506- decode_and_add_device (struct inode * inode , struct pnfs_device * dev )
506+ decode_and_add_device (struct inode * inode , struct pnfs_device * dev , gfp_t gfp_flags )
507507{
508508 struct nfs4_file_layout_dsaddr * d , * new ;
509509 long hash ;
510510
511- new = decode_device (inode , dev );
511+ new = decode_device (inode , dev , gfp_flags );
512512 if (!new ) {
513513 printk (KERN_WARNING "%s: Could not decode or add device\n" ,
514514 __func__ );
@@ -537,7 +537,7 @@ decode_and_add_device(struct inode *inode, struct pnfs_device *dev)
537537 * of available devices, and return it.
538538 */
539539struct nfs4_file_layout_dsaddr *
540- get_device_info (struct inode * inode , struct nfs4_deviceid * dev_id )
540+ get_device_info (struct inode * inode , struct nfs4_deviceid * dev_id , gfp_t gfp_flags )
541541{
542542 struct pnfs_device * pdev = NULL ;
543543 u32 max_resp_sz ;
@@ -556,17 +556,17 @@ get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id)
556556 dprintk ("%s inode %p max_resp_sz %u max_pages %d\n" ,
557557 __func__ , inode , max_resp_sz , max_pages );
558558
559- pdev = kzalloc (sizeof (struct pnfs_device ), GFP_KERNEL );
559+ pdev = kzalloc (sizeof (struct pnfs_device ), gfp_flags );
560560 if (pdev == NULL )
561561 return NULL ;
562562
563- pages = kzalloc (max_pages * sizeof (struct page * ), GFP_KERNEL );
563+ pages = kzalloc (max_pages * sizeof (struct page * ), gfp_flags );
564564 if (pages == NULL ) {
565565 kfree (pdev );
566566 return NULL ;
567567 }
568568 for (i = 0 ; i < max_pages ; i ++ ) {
569- pages [i ] = alloc_page (GFP_KERNEL );
569+ pages [i ] = alloc_page (gfp_flags );
570570 if (!pages [i ])
571571 goto out_free ;
572572 }
@@ -587,7 +587,7 @@ get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id)
587587 * Found new device, need to decode it and then add it to the
588588 * list of known devices for this mountpoint.
589589 */
590- dsaddr = decode_and_add_device (inode , pdev );
590+ dsaddr = decode_and_add_device (inode , pdev , gfp_flags );
591591out_free :
592592 for (i = 0 ; i < max_pages ; i ++ )
593593 __free_page (pages [i ]);
0 commit comments