summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/export.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-01-29 18:43:25 +0530
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 09:15:28 -0400
commit5fe0c2378884e68beb532f5890cc0e3539ac747b (patch)
treebe25414052184e146049ea6466854366559d5528 /fs/btrfs/export.c
parentc8b91accfa1059d5565443193d89572eca2f5dd6 (diff)
downloadlinux-stable-5fe0c2378884e68beb532f5890cc0e3539ac747b.tar.gz
linux-stable-5fe0c2378884e68beb532f5890cc0e3539ac747b.tar.bz2
linux-stable-5fe0c2378884e68beb532f5890cc0e3539ac747b.zip
exportfs: Return the minimum required handle size
The exportfs encode handle function should return the minimum required handle size. This helps user to find out the handle size by passing 0 handle size in the first step and then redoing to the call again with the returned handle size value. Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs/export.c')
-rw-r--r--fs/btrfs/export.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index ff27d7a477b2..b4ffad859adb 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -21,9 +21,13 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len,
int len = *max_len;
int type;
- if ((len < BTRFS_FID_SIZE_NON_CONNECTABLE) ||
- (connectable && len < BTRFS_FID_SIZE_CONNECTABLE))
+ if (connectable && (len < BTRFS_FID_SIZE_CONNECTABLE)) {
+ *max_len = BTRFS_FID_SIZE_CONNECTABLE;
return 255;
+ } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) {
+ *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE;
+ return 255;
+ }
len = BTRFS_FID_SIZE_NON_CONNECTABLE;
type = FILEID_BTRFS_WITHOUT_PARENT;