aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 4d05456ec32f..54c754dd9a14 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -436,10 +436,18 @@ static inline u##bits btrfs_##name(struct extent_buffer *eb, \
436 unsigned long map_len; \ 436 unsigned long map_len; \
437 unsigned long offset = (unsigned long)s + \ 437 unsigned long offset = (unsigned long)s + \
438 offsetof(type, member); \ 438 offsetof(type, member); \
439 err = map_extent_buffer(eb, offset, \ 439 if (eb->map_token && offset >= eb->map_start && \
440 offset + sizeof(((type *)0)->member) <= eb->map_start + \
441 eb->map_len) { \
442 kaddr = eb->kaddr; \
443 map_start = eb->map_start; \
444 err = 0; \
445 } else { \
446 err = map_extent_buffer(eb, offset, \
440 sizeof(((type *)0)->member), \ 447 sizeof(((type *)0)->member), \
441 &map_token, &kaddr, \ 448 &map_token, &kaddr, \
442 &map_start, &map_len, KM_USER1); \ 449 &map_start, &map_len, KM_USER1); \
450 } \
443 if (!err) { \ 451 if (!err) { \
444 __le##bits *tmp = (__le##bits *)(kaddr + offset - \ 452 __le##bits *tmp = (__le##bits *)(kaddr + offset - \
445 map_start); \ 453 map_start); \
@@ -464,10 +472,18 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \
464 int unmap_on_exit = (eb->map_token == NULL); \ 472 int unmap_on_exit = (eb->map_token == NULL); \
465 unsigned long offset = (unsigned long)s + \ 473 unsigned long offset = (unsigned long)s + \
466 offsetof(type, member); \ 474 offsetof(type, member); \
467 err = map_extent_buffer(eb, offset, \ 475 if (eb->map_token && offset >= eb->map_start && \
476 offset + sizeof(((type *)0)->member) <= eb->map_start + \
477 eb->map_len) { \
478 kaddr = eb->kaddr; \
479 map_start = eb->map_start; \
480 err = 0; \
481 } else { \
482 err = map_extent_buffer(eb, offset, \
468 sizeof(((type *)0)->member), \ 483 sizeof(((type *)0)->member), \
469 &map_token, &kaddr, \ 484 &map_token, &kaddr, \
470 &map_start, &map_len, KM_USER1); \ 485 &map_start, &map_len, KM_USER1); \
486 } \
471 if (!err) { \ 487 if (!err) { \
472 __le##bits *tmp = (__le##bits *)(kaddr + offset - \ 488 __le##bits *tmp = (__le##bits *)(kaddr + offset - \
473 map_start); \ 489 map_start); \
@@ -490,10 +506,18 @@ static inline u##bits btrfs_##name(struct extent_buffer *eb) \
490 unsigned long map_len; \ 506 unsigned long map_len; \
491 unsigned long offset = offsetof(type, member); \ 507 unsigned long offset = offsetof(type, member); \
492 int unmap_on_exit = (eb->map_token == NULL); \ 508 int unmap_on_exit = (eb->map_token == NULL); \
493 err = map_extent_buffer(eb, offset, \ 509 if (eb->map_token && offset >= eb->map_start && \
510 offset + sizeof(((type *)0)->member) <= eb->map_start + \
511 eb->map_len) { \
512 kaddr = eb->kaddr; \
513 map_start = eb->map_start; \
514 err = 0; \
515 } else { \
516 err = map_extent_buffer(eb, offset, \
494 sizeof(((type *)0)->member), \ 517 sizeof(((type *)0)->member), \
495 &map_token, &kaddr, \ 518 &map_token, &kaddr, \
496 &map_start, &map_len, KM_USER1); \ 519 &map_start, &map_len, KM_USER1); \
520 } \
497 if (!err) { \ 521 if (!err) { \
498 __le##bits *tmp = (__le##bits *)(kaddr + offset - \ 522 __le##bits *tmp = (__le##bits *)(kaddr + offset - \
499 map_start); \ 523 map_start); \
@@ -517,10 +541,18 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \
517 unsigned long map_len; \ 541 unsigned long map_len; \
518 unsigned long offset = offsetof(type, member); \ 542 unsigned long offset = offsetof(type, member); \
519 int unmap_on_exit = (eb->map_token == NULL); \ 543 int unmap_on_exit = (eb->map_token == NULL); \
520 err = map_extent_buffer(eb, offset, \ 544 if (eb->map_token && offset >= eb->map_start && \
545 offset + sizeof(((type *)0)->member) <= eb->map_start + \
546 eb->map_len) { \
547 kaddr = eb->kaddr; \
548 map_start = eb->map_start; \
549 err = 0; \
550 } else { \
551 err = map_extent_buffer(eb, offset, \
521 sizeof(((type *)0)->member), \ 552 sizeof(((type *)0)->member), \
522 &map_token, &kaddr, \ 553 &map_token, &kaddr, \
523 &map_start, &map_len, KM_USER1); \ 554 &map_start, &map_len, KM_USER1); \
555 } \
524 if (!err) { \ 556 if (!err) { \
525 __le##bits *tmp = (__le##bits *)(kaddr + offset - \ 557 __le##bits *tmp = (__le##bits *)(kaddr + offset - \
526 map_start); \ 558 map_start); \