summaryrefslogtreecommitdiffstats
path: root/src/os
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-02-21 22:26:40 +0100
committerSamuel Just <sam.just@inktank.com>2013-02-21 22:26:40 +0100
commitc33c51f01f79c6e180d1ef8157fb908ac44995e8 (patch)
tree56bcc3c9210bc0c2aa3e0fdb9dc6b9f9b9b6ff5c /src/os
parentFileStore::_setattrs: only do omap operations if necessary (diff)
downloadceph-c33c51f01f79c6e180d1ef8157fb908ac44995e8.tar.xz
ceph-c33c51f01f79c6e180d1ef8157fb908ac44995e8.zip
FileStore: add _fsetattrs
Signed-off-by: Samuel Just <sam.just@inktank.com>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/FileStore.cc21
-rw-r--r--src/os/FileStore.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index deab9ede875..a8f23ba97e8 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -3720,6 +3720,27 @@ int FileStore::_fgetattrs(int fd, map<string,bufferptr>& aset, bool user_only)
return 0;
}
+int FileStore::_fsetattrs(int fd, map<string, bufferptr> &aset)
+{
+ for (map<string, bufferptr>::iterator p = aset.begin();
+ p != aset.end();
+ ++p) {
+ char n[CHAIN_XATTR_MAX_NAME_LEN];
+ get_attrname(p->first.c_str(), n, CHAIN_XATTR_MAX_NAME_LEN);
+ const char *val;
+ if (p->second.length())
+ val = p->second.c_str();
+ else
+ val = "";
+ // ??? Why do we skip setting all the other attrs if one fails?
+ int r = chain_fsetxattr(fd, n, val, p->second.length());
+ if (r < 0) {
+ derr << "FileStore::_setattrs: chain_setxattr returned " << r << dendl;
+ return r;
+ }
+ }
+ return 0;
+}
// objects
diff --git a/src/os/FileStore.h b/src/os/FileStore.h
index 3336e59378e..e739447afc0 100644
--- a/src/os/FileStore.h
+++ b/src/os/FileStore.h
@@ -386,6 +386,7 @@ public:
int _fgetattr(int fd, const char *name, bufferptr& bp);
int _fgetattrs(int fd, map<string,bufferptr>& aset, bool user_only);
+ int _fsetattrs(int fd, map<string, bufferptr> &aset);
void _start_sync();