mfi_volume.c (b9f2f8c36f23f48488e9f8ae2b018d3fa6c3a44b) mfi_volume.c (8b22f43d9da9cd42652b642b4b4f447825a86c4f)
1/*-
2 * Copyright (c) 2008, 2009 Yahoo!, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

133 printf("Setting write cache policy to %s\n",
134 policy & MR_LD_CACHE_WRITE_BACK ? "write-back" :
135 "write-through");
136 if (changes & (MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE))
137 printf("Setting read ahead policy to %s\n",
138 policy & MR_LD_CACHE_READ_AHEAD ?
139 (policy & MR_LD_CACHE_READ_ADAPTIVE ?
140 "adaptive" : "always") : "none");
1/*-
2 * Copyright (c) 2008, 2009 Yahoo!, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

133 printf("Setting write cache policy to %s\n",
134 policy & MR_LD_CACHE_WRITE_BACK ? "write-back" :
135 "write-through");
136 if (changes & (MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE))
137 printf("Setting read ahead policy to %s\n",
138 policy & MR_LD_CACHE_READ_AHEAD ?
139 (policy & MR_LD_CACHE_READ_ADAPTIVE ?
140 "adaptive" : "always") : "none");
141 if (changes & MR_LD_CACHE_WRITE_CACHE_BAD_BBU)
142 printf("%s write caching with bad BBU\n",
143 policy & MR_LD_CACHE_WRITE_CACHE_BAD_BBU ? "Enabling" :
144 "Disabling");
141
142 props->default_cache_policy = policy;
143 if (mfi_ld_set_props(fd, props) < 0) {
144 error = errno;
145 warn("Failed to set volume properties");
146 return (error);
147 }
148 return (0);

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

177 error = errno;
178 warn("Failed to fetch volume properties");
179 return (error);
180 }
181
182 if (ac == 2) {
183 printf("mfi%u volume %s cache settings:\n", mfi_unit,
184 mfi_volume_name(fd, target_id));
145
146 props->default_cache_policy = policy;
147 if (mfi_ld_set_props(fd, props) < 0) {
148 error = errno;
149 warn("Failed to set volume properties");
150 return (error);
151 }
152 return (0);

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

181 error = errno;
182 warn("Failed to fetch volume properties");
183 return (error);
184 }
185
186 if (ac == 2) {
187 printf("mfi%u volume %s cache settings:\n", mfi_unit,
188 mfi_volume_name(fd, target_id));
185 printf(" I/O caching: ");
189 printf(" I/O caching: ");
186 switch (props.default_cache_policy &
187 (MR_LD_CACHE_ALLOW_WRITE_CACHE |
188 MR_LD_CACHE_ALLOW_READ_CACHE)) {
189 case 0:
190 printf("disabled\n");
191 break;
192 case MR_LD_CACHE_ALLOW_WRITE_CACHE:
193 printf("writes\n");
194 break;
195 case MR_LD_CACHE_ALLOW_READ_CACHE:
196 printf("reads\n");
197 break;
198 case MR_LD_CACHE_ALLOW_WRITE_CACHE |
199 MR_LD_CACHE_ALLOW_READ_CACHE:
200 printf("writes and reads\n");
201 break;
202 }
190 switch (props.default_cache_policy &
191 (MR_LD_CACHE_ALLOW_WRITE_CACHE |
192 MR_LD_CACHE_ALLOW_READ_CACHE)) {
193 case 0:
194 printf("disabled\n");
195 break;
196 case MR_LD_CACHE_ALLOW_WRITE_CACHE:
197 printf("writes\n");
198 break;
199 case MR_LD_CACHE_ALLOW_READ_CACHE:
200 printf("reads\n");
201 break;
202 case MR_LD_CACHE_ALLOW_WRITE_CACHE |
203 MR_LD_CACHE_ALLOW_READ_CACHE:
204 printf("writes and reads\n");
205 break;
206 }
203 printf(" write caching: %s\n",
207 printf(" write caching: %s\n",
204 props.default_cache_policy & MR_LD_CACHE_WRITE_BACK ?
205 "write-back" : "write-through");
208 props.default_cache_policy & MR_LD_CACHE_WRITE_BACK ?
209 "write-back" : "write-through");
206 printf(" read ahead: %s\n",
210 printf("write cache with bad BBU: %s\n",
211 props.default_cache_policy &
212 MR_LD_CACHE_WRITE_CACHE_BAD_BBU ? "enabled" : "disabled");
213 printf(" read ahead: %s\n",
207 props.default_cache_policy & MR_LD_CACHE_READ_AHEAD ?
208 (props.default_cache_policy & MR_LD_CACHE_READ_ADAPTIVE ?
209 "adaptive" : "always") : "none");
214 props.default_cache_policy & MR_LD_CACHE_READ_AHEAD ?
215 (props.default_cache_policy & MR_LD_CACHE_READ_ADAPTIVE ?
216 "adaptive" : "always") : "none");
210 printf("drive write cache: ");
217 printf(" drive write cache: ");
211 switch (props.disk_cache_policy) {
212 case MR_PD_CACHE_UNCHANGED:
213 printf("default\n");
214 break;
215 case MR_PD_CACHE_ENABLE:
216 printf("enabled\n");
217 break;
218 case MR_PD_CACHE_DISABLE:

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

268 MR_LD_CACHE_READ_ADAPTIVE;
269 else {
270 warnx("cache: invalid read-ahead setting");
271 return (EINVAL);
272 }
273 error = update_cache_policy(fd, &props, policy,
274 MR_LD_CACHE_READ_AHEAD |
275 MR_LD_CACHE_READ_ADAPTIVE);
218 switch (props.disk_cache_policy) {
219 case MR_PD_CACHE_UNCHANGED:
220 printf("default\n");
221 break;
222 case MR_PD_CACHE_ENABLE:
223 printf("enabled\n");
224 break;
225 case MR_PD_CACHE_DISABLE:

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

275 MR_LD_CACHE_READ_ADAPTIVE;
276 else {
277 warnx("cache: invalid read-ahead setting");
278 return (EINVAL);
279 }
280 error = update_cache_policy(fd, &props, policy,
281 MR_LD_CACHE_READ_AHEAD |
282 MR_LD_CACHE_READ_ADAPTIVE);
283 } else if (strcmp(av[2], "bad-bbu-write-cache") == 0) {
284 if (ac < 4) {
285 warnx("cache: bad BBU setting required");
286 return (EINVAL);
287 }
288 if (strcmp(av[3], "enable") == 0)
289 policy = MR_LD_CACHE_WRITE_CACHE_BAD_BBU;
290 else if (strcmp(av[3], "disable") == 0)
291 policy = 0;
292 else {
293 warnx("cache: invalid bad BBU setting");
294 return (EINVAL);
295 }
296 error = update_cache_policy(fd, &props, policy,
297 MR_LD_CACHE_WRITE_CACHE_BAD_BBU);
276 } else if (strcmp(av[2], "write-cache") == 0) {
277 if (ac < 4) {
278 warnx("cache: write-cache setting required");
279 return (EINVAL);
280 }
281 if (strcmp(av[3], "enable") == 0)
282 policy = MR_PD_CACHE_ENABLE;
283 else if (strcmp(av[3], "disable") == 0)

--- 141 unchanged lines hidden ---
298 } else if (strcmp(av[2], "write-cache") == 0) {
299 if (ac < 4) {
300 warnx("cache: write-cache setting required");
301 return (EINVAL);
302 }
303 if (strcmp(av[3], "enable") == 0)
304 policy = MR_PD_CACHE_ENABLE;
305 else if (strcmp(av[3], "disable") == 0)

--- 141 unchanged lines hidden ---