flexfilelayoutdev.c (094069f1d96f691637b5c335f5eb79566d2457ff) flexfilelayoutdev.c (95e2b7e95d43c5c95620b12355a90713268376d3)
1/*
2 * Device operations for the pnfs nfs4 file layout driver.
3 *
4 * Copyright (c) 2014, Primary Data, Inc. All rights reserved.
5 *
6 * Tao Peng <bergwolf@primarydata.com>
7 */
8

--- 329 unchanged lines hidden (view full) ---

338 }
339
340 /* FIXME: For now assume there is only 1 version available for the DS */
341 fh = &mirror->fh_versions[0];
342out:
343 return fh;
344}
345
1/*
2 * Device operations for the pnfs nfs4 file layout driver.
3 *
4 * Copyright (c) 2014, Primary Data, Inc. All rights reserved.
5 *
6 * Tao Peng <bergwolf@primarydata.com>
7 */
8

--- 329 unchanged lines hidden (view full) ---

338 }
339
340 /* FIXME: For now assume there is only 1 version available for the DS */
341 fh = &mirror->fh_versions[0];
342out:
343 return fh;
344}
345
346/* Upon return, either ds is connected, or ds is NULL */
346/**
347 * nfs4_ff_layout_prepare_ds - prepare a DS connection for an RPC call
348 * @lseg: the layout segment we're operating on
349 * @ds_idx: index of the DS to use
350 * @fail_return: return layout on connect failure?
351 *
352 * Try to prepare a DS connection to accept an RPC call. This involves
353 * selecting a mirror to use and connecting the client to it if it's not
354 * already connected.
355 *
356 * Since we only need a single functioning mirror to satisfy a read, we don't
357 * want to return the layout if there is one. For writes though, any down
358 * mirror should result in a LAYOUTRETURN. @fail_return is how we distinguish
359 * between the two cases.
360 *
361 * Returns a pointer to a connected DS object on success or NULL on failure.
362 */
347struct nfs4_pnfs_ds *
348nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
349 bool fail_return)
350{
351 struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, ds_idx);
352 struct nfs4_pnfs_ds *ds = NULL;
353 struct nfs4_deviceid_node *devid;
354 struct inode *ino = lseg->pls_layout->plh_inode;

--- 197 unchanged lines hidden ---
363struct nfs4_pnfs_ds *
364nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
365 bool fail_return)
366{
367 struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, ds_idx);
368 struct nfs4_pnfs_ds *ds = NULL;
369 struct nfs4_deviceid_node *devid;
370 struct inode *ino = lseg->pls_layout->plh_inode;

--- 197 unchanged lines hidden ---