Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 938655 Details for
Bug 1143753
LVM cache: 'lvs' is unable to print the cachemode
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
broken patch
cachemode-report.patch (text/plain), 6.62 KB, created by
Jonathan Earl Brassow
on 2014-09-17 22:19:54 UTC
(
hide
)
Description:
broken patch
Filename:
MIME Type:
Creator:
Jonathan Earl Brassow
Created:
2014-09-17 22:19:54 UTC
Size:
6.62 KB
patch
obsolete
>Index: lvm2/lib/activate/activate.c >=================================================================== >--- lvm2.orig/lib/activate/activate.c >+++ lvm2/lib/activate/activate.c >@@ -294,6 +294,11 @@ int lv_cache_policy_info(struct logical_ > { > return 0; > } >+int lv_cache_cachemode_info(struct logical_volume *lv, >+ char **cachemode_str, uint32_t *cachemode_flags); >+{ >+ return 0; >+} > int lv_thin_pool_percent(const struct logical_volume *lv, int metadata, > dm_percent_t *percent) > { >@@ -1136,6 +1141,84 @@ int lv_cache_policy_info(struct logical_ > } > > dev_manager_destroy(dm); >+ >+ return 1; >+} >+ >+int lv_cache_cachemode_info(struct logical_volume *lv, >+ char **cachemode_str, uint32_t *cachemode_flags) >+{ >+ int i; >+ struct lv_segment *cache_seg; >+ struct logical_volume *cache_lv; >+ struct dev_manager *dm; >+ struct dm_status_cache *status; >+ struct dm_pool *mem = lv->vg->cmd->mem; >+ >+ /* The user is free to choose which args they are interested in */ >+ if (cachemode_str) >+ *cachemode_str = NULL; >+ if (cachemode_flags) >+ *cachemode_flags = 0; >+ >+ if (lv_is_cache(lv)) >+ cache_lv = lv; >+ else if (lv_is_cache_pool(lv)) { >+ if (dm_list_empty(&lv->segs_using_this_lv)) { >+ //FIXME: Ok to return value not sourced from kernel? >+ log_error(INTERNAL_ERROR "Unable to get cachemode" >+ " of unlinked cache_pool, %s", lv->name); >+ //FIXME: ... because we could do this: >+ if (cachemode_str) { >+ if (first_seg(lv)->feature_flags & >+ DM_CACHE_FEATURE_WRITEBACK) >+ *cachemode_str = dm_pool_strdup(mem, "writeback"); >+ else if (first_seg(lv)->feature_flags & >+ DM_CACHE_FEATURE_WRITETHROUGH) >+ *cachemode_str = dm_pool_strdup(mem, "writethrough"); >+ else >+ *cachemode_str = NULL; >+ } >+ if (cachemode_flags) >+ *cachemode_flags = first_seg(lv)->feature_flags; >+ return 1; >+ } >+ if (!(cache_seg = get_only_segment_using_this_lv(lv))) >+ return_0; >+ cache_lv = cache_seg->lv; >+ } else { >+ log_error(INTERNAL_ERROR >+ "Unable to get policy info of non-cache LV, %s", >+ lv->name); >+ return 0; >+ } >+ >+ if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0)) >+ return_0; >+ >+ log_debug_activation("Checking cachemode for LV %s/%s", >+ cache_lv->vg->name, cache_lv->name); >+ >+ if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1))) >+ return_0; >+ >+ if (!dev_manager_cache_status(dm, cache_lv, &status)) { >+ dev_manager_destroy(dm); >+ return_0; >+ } >+ >+ if (cachemode_flags) >+ *cachemode_flags = status->feature_flags; >+ if (cachemode_str) { >+ if (status->feature_flags & DM_CACHE_FEATURE_WRITEBACK) >+ *cachemode_str = dm_pool_strdup(mem, "writeback"); >+ else if (status->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH) >+ *cachemode_str = dm_pool_strdup(mem, "writethrough"); >+ else >+ *cachemode_str = NULL; >+ } >+ >+ dev_manager_destroy(dm); > > return 1; > } >Index: lvm2/lib/activate/activate.h >=================================================================== >--- lvm2.orig/lib/activate/activate.h >+++ lvm2/lib/activate/activate.h >@@ -126,6 +126,8 @@ int lv_cache_block_info(struct logical_v > int lv_cache_policy_info(struct logical_volume *lv, > const char **policy_name, int *policy_argc, > const char ***policy_argv); >+int lv_cache_cachemode_info(struct logical_volume *lv, >+ char **cachemode_str, uint32_t *cachemode_flags); > int lv_thin_pool_percent(const struct logical_volume *lv, int metadata, > dm_percent_t *percent); > int lv_thin_percent(const struct logical_volume *lv, int mapped, >Index: lvm2/lib/report/columns.h >=================================================================== >--- lvm2.orig/lib/report/columns.h >+++ lvm2/lib/report/columns.h >@@ -85,6 +85,7 @@ FIELD(LVS, lv, STR, "LProfile", lvid, 8, > FIELD(LVS, lv, STR, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0) > FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) > FIELD(LVS, lv, STR_LIST, "Modules", lvid, 7, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0) >+FIELD(LVS, lv, STR, "CacheMode", lvid, 9, cachemode, cache_mode, "For cache LVs, the cache mode (e.g. \"writeback\").", 0) > > FIELD(LVSINFO, lv, NUM, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0) > FIELD(LVSINFO, lv, NUM, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0) >Index: lvm2/lib/report/properties.c >=================================================================== >--- lvm2.orig/lib/report/properties.c >+++ lvm2/lib/report/properties.c >@@ -304,6 +304,8 @@ GET_LV_STR_PROPERTY_FN(lv_active, lv_act > #define _lv_active_set prop_not_implemented_set > GET_LV_STR_PROPERTY_FN(lv_profile, lv_profile_dup(lv->vg->vgmem, lv)) > #define _lv_profile_set prop_not_implemented_set >+GET_LV_STR_PROPERTY_FN(cache_mode, lv_cachemode_dup(lv->vg->vgmem, lv)) >+#define _cache_mode_set prop_not_implemented_set > > /* VG */ > GET_VG_STR_PROPERTY_FN(vg_fmt, vg_fmt_dup(vg)) >Index: lvm2/lib/report/report.c >=================================================================== >--- lvm2.orig/lib/report/report.c >+++ lvm2/lib/report/report.c >@@ -266,6 +266,22 @@ static int _lvprofile_disp(struct dm_rep > return _field_set_value(field, "", NULL); > } > >+static int _lvcachemode_disp(struct dm_report *rh, struct dm_pool *mem, >+ struct dm_report_field *field, >+ const void *data, void *private) >+{ >+ char *cachemode_str; >+ struct logical_volume *lv = (struct logical_volume *) data; >+ >+ if (!lv_cache_cachemode_info(lv, &cachemode_str, NULL)) >+ return_0; >+ >+ if (!cachemode_str) >+ return _field_set_value(field, "", NULL); >+ >+ return dm_report_field_string(rh, field, &cachemode_str); >+} >+ > static int _vgfmt_disp(struct dm_report *rh, struct dm_pool *mem, > struct dm_report_field *field, > const void *data, void *private) >Index: lvm2/lib/metadata/lv.c >=================================================================== >--- lvm2.orig/lib/metadata/lv.c >+++ lvm2/lib/metadata/lv.c >@@ -942,6 +942,22 @@ char *lv_profile_dup(struct dm_pool *mem > return dm_pool_strdup(mem, profile_name); > } > >+char *lv_cachemode_dup(struct dm_pool *mem, const struct logical_volume *lv) >+{ >+ uint32_t feature_flags; >+ const char *cachemode_str; >+ >+ if (!lv_cache_cachemode_info(lv, NULL, &feature_flags)) >+ return NULL; // FIXME: should this be ""? >+ >+ cachemode_str = >+ (feature_flags & DM_CACHE_FEATURE_WRITEBACK) ? "writeback" : >+ (feature_flags & DM_CACHE_FEATURE_WRITEBACK) ? "writeback" : >+ ""; >+ >+ return dm_pool_strdup(mem, cachemode_str); >+} >+ > /* For given LV find recursively the LV which holds lock for it */ > const struct logical_volume *lv_lock_holder(const struct logical_volume *lv) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1143753
: 938655