Commit aaae68e5 authored by Christian Mohrbacher's avatar Christian Mohrbacher Committed by Oliver Steffen

storage: remove zfsPropertyString param from QuotaTk::requestQuotaFromZFS

it was never actually set from the outside. It was generated by the function
and then re-used if there were more zfs block devices to avoid another init
of the string. However, that was quite confusing and not very much of an

(cherry picked from commit ade1da44709d8443cddf843af67d4d684af386e9)
parent b911a6eb
......@@ -120,7 +120,6 @@ bool QuotaTk::checkQuota(QuotaBlockDeviceMap* blockDevices, QuotaData* outData,
fs_disk_quota xfsQuotaData; // required for XFS
QuotaData tmpQuotaData(outData->getID(), outData->getType() ); // required for ZFS
std::string zfsPropertyString;
QuotaDataType quotaType = outData->getType();
for(QuotaBlockDeviceMapIter iter = blockDevices->begin(); iter != blockDevices->end(); iter++)
......@@ -155,8 +154,7 @@ bool QuotaTk::checkQuota(QuotaBlockDeviceMap* blockDevices, QuotaData* outData,
return false;
if(QuotaTk::requestQuotaFromZFS(&iter->second, iter->first, &zfsPropertyString,
&tmpQuotaData, session) )
if(QuotaTk::requestQuotaFromZFS(&iter->second, iter->first, &tmpQuotaData, session))
errorCode = FhgfsOpsErr_SUCCESS;
......@@ -352,9 +350,8 @@ bool QuotaTk::checkRequiredLibZfsFunctions(QuotaBlockDevice* blockDevice, uint16
// check if the signature of all function pointers are compatible
std::string propertyString;
QuotaData quotaData(0, QuotaDataType_USER); // test request for user root
if(!requestQuotaFromZFS(blockDevice, targetNumID, &propertyString, &quotaData, &session) )
if(!requestQuotaFromZFS(blockDevice, targetNumID, &quotaData, &session) )
return false;
// check function pointers which are required in case of errors happens
......@@ -369,16 +366,13 @@ bool QuotaTk::checkRequiredLibZfsFunctions(QuotaBlockDevice* blockDevice, uint16
* @param blockDevice the QuotaBlockDevice to check
* @param targetNumID the targetNumID of the storage target
* @param zfsPropertyString could be an empty string, is initialized during the first execution of
* this function and should be reused during the next call for the next
* QuotaBlockDevice (example: "userused@5111")
* @param outData needs to be initialized with type and ID
* @param session a session for all required lib handles if zfs is used, it can be an uninitialized
* session, the initialization can be done by this function
* @return false on error (in which case outData is not initialized)
bool QuotaTk::requestQuotaFromZFS(QuotaBlockDevice* blockDevice, uint16_t targetNumID,
std::string* zfsPropertyString, QuotaData* outData, ZfsSession* session)
QuotaData* outData, ZfsSession* session)
std::string logContext("requestQuotaFromZFS");
......@@ -397,17 +391,13 @@ bool QuotaTk::requestQuotaFromZFS(QuotaBlockDevice* blockDevice, uint16_t target
uint64_t usedSizeValue = 0;
if(zfsPropertyString->empty() )
if(outData->getType() == QuotaDataType_USER)
zfsPropertyString->assign(QUOTATK_ZFS_USER_QUOTA +
StringTk::uintToStr(outData->getID() ) );
zfsPropertyString->assign(QUOTATK_ZFS_GROUP_QUOTA +
StringTk::uintToStr(outData->getID() ) );
std::string zfsPropertyString;
if(outData->getType() == QuotaDataType_USER)
zfsPropertyString = QUOTATK_ZFS_USER_QUOTA + StringTk::uintToStr(outData->getID());
zfsPropertyString = QUOTATK_ZFS_GROUP_QUOTA + StringTk::uintToStr(outData->getID());
int error = (*session->zfs_prop_get_userquota_int)(zfsHandle, zfsPropertyString->c_str(),
int error = (*session->zfs_prop_get_userquota_int)(zfsHandle, zfsPropertyString.c_str(),
......@@ -35,7 +35,7 @@ class QuotaTk
static bool checkRequiredLibZfsFunctions(QuotaBlockDevice* blockDevice, uint16_t targetNumID);
static bool requestQuotaFromZFS(QuotaBlockDevice* blockDevice, uint16_t targetNumID,
std::string* zfsPropertyString, QuotaData* outData, ZfsSession* session);
QuotaData* outData, ZfsSession* session);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment