libceph: change ceph_osdmap_flag() to take osdc
For the benefit of every single caller, take osdc instead of map. Also, now that osdc->osdmap can't ever be NULL, drop the check. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
1a695a905c
commit
b7ec35b304
4 changed files with 28 additions and 29 deletions
|
@ -1349,7 +1349,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||||
}
|
}
|
||||||
|
|
||||||
retry_snap:
|
retry_snap:
|
||||||
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL)) {
|
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL)) {
|
||||||
err = -ENOSPC;
|
err = -ENOSPC;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1440,7 @@ retry_snap:
|
||||||
ceph_put_cap_refs(ci, got);
|
ceph_put_cap_refs(ci, got);
|
||||||
|
|
||||||
if (written >= 0) {
|
if (written >= 0) {
|
||||||
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL))
|
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_NEARFULL))
|
||||||
iocb->ki_flags |= IOCB_DSYNC;
|
iocb->ki_flags |= IOCB_DSYNC;
|
||||||
|
|
||||||
written = generic_write_sync(iocb, written);
|
written = generic_write_sync(iocb, written);
|
||||||
|
@ -1672,7 +1672,7 @@ static long ceph_fallocate(struct file *file, int mode,
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) &&
|
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) &&
|
||||||
!(mode & FALLOC_FL_PUNCH_HOLE)) {
|
!(mode & FALLOC_FL_PUNCH_HOLE)) {
|
||||||
ret = -ENOSPC;
|
ret = -ENOSPC;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
|
@ -279,6 +279,11 @@ struct ceph_osd_client {
|
||||||
struct workqueue_struct *notify_wq;
|
struct workqueue_struct *notify_wq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool ceph_osdmap_flag(struct ceph_osd_client *osdc, int flag)
|
||||||
|
{
|
||||||
|
return osdc->osdmap->flags & flag;
|
||||||
|
}
|
||||||
|
|
||||||
extern int ceph_osdc_setup(void);
|
extern int ceph_osdc_setup(void);
|
||||||
extern void ceph_osdc_cleanup(void);
|
extern void ceph_osdc_cleanup(void);
|
||||||
|
|
||||||
|
|
|
@ -189,11 +189,6 @@ static inline bool ceph_osd_is_down(struct ceph_osdmap *map, int osd)
|
||||||
return !ceph_osd_is_up(map, osd);
|
return !ceph_osd_is_up(map, osd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
|
|
||||||
{
|
|
||||||
return map && (map->flags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern char *ceph_osdmap_state_str(char *str, int len, int state);
|
extern char *ceph_osdmap_state_str(char *str, int len, int state);
|
||||||
extern u32 ceph_get_primary_affinity(struct ceph_osdmap *map, int osd);
|
extern u32 ceph_get_primary_affinity(struct ceph_osdmap *map, int osd);
|
||||||
|
|
||||||
|
|
|
@ -1276,9 +1276,9 @@ static bool target_should_be_paused(struct ceph_osd_client *osdc,
|
||||||
const struct ceph_osd_request_target *t,
|
const struct ceph_osd_request_target *t,
|
||||||
struct ceph_pg_pool_info *pi)
|
struct ceph_pg_pool_info *pi)
|
||||||
{
|
{
|
||||||
bool pauserd = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD);
|
bool pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD);
|
||||||
bool pausewr = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSEWR) ||
|
bool pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) ||
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) ||
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
|
||||||
__pool_full(pi);
|
__pool_full(pi);
|
||||||
|
|
||||||
WARN_ON(pi->id != t->base_oloc.pool);
|
WARN_ON(pi->id != t->base_oloc.pool);
|
||||||
|
@ -1303,8 +1303,7 @@ static enum calc_target_result calc_target(struct ceph_osd_client *osdc,
|
||||||
bool force_resend = false;
|
bool force_resend = false;
|
||||||
bool need_check_tiering = false;
|
bool need_check_tiering = false;
|
||||||
bool need_resend = false;
|
bool need_resend = false;
|
||||||
bool sort_bitwise = ceph_osdmap_flag(osdc->osdmap,
|
bool sort_bitwise = ceph_osdmap_flag(osdc, CEPH_OSDMAP_SORTBITWISE);
|
||||||
CEPH_OSDMAP_SORTBITWISE);
|
|
||||||
enum calc_target_result ct_res;
|
enum calc_target_result ct_res;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1590,9 +1589,9 @@ static void maybe_request_map(struct ceph_osd_client *osdc)
|
||||||
verify_osdc_locked(osdc);
|
verify_osdc_locked(osdc);
|
||||||
WARN_ON(!osdc->osdmap->epoch);
|
WARN_ON(!osdc->osdmap->epoch);
|
||||||
|
|
||||||
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) ||
|
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD) ||
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD) ||
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSEWR)) {
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR)) {
|
||||||
dout("%s osdc %p continuous\n", __func__, osdc);
|
dout("%s osdc %p continuous\n", __func__, osdc);
|
||||||
continuous = true;
|
continuous = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1629,19 +1628,19 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((req->r_flags & CEPH_OSD_FLAG_WRITE) &&
|
if ((req->r_flags & CEPH_OSD_FLAG_WRITE) &&
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSEWR)) {
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR)) {
|
||||||
dout("req %p pausewr\n", req);
|
dout("req %p pausewr\n", req);
|
||||||
req->r_t.paused = true;
|
req->r_t.paused = true;
|
||||||
maybe_request_map(osdc);
|
maybe_request_map(osdc);
|
||||||
} else if ((req->r_flags & CEPH_OSD_FLAG_READ) &&
|
} else if ((req->r_flags & CEPH_OSD_FLAG_READ) &&
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD)) {
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD)) {
|
||||||
dout("req %p pauserd\n", req);
|
dout("req %p pauserd\n", req);
|
||||||
req->r_t.paused = true;
|
req->r_t.paused = true;
|
||||||
maybe_request_map(osdc);
|
maybe_request_map(osdc);
|
||||||
} else if ((req->r_flags & CEPH_OSD_FLAG_WRITE) &&
|
} else if ((req->r_flags & CEPH_OSD_FLAG_WRITE) &&
|
||||||
!(req->r_flags & (CEPH_OSD_FLAG_FULL_TRY |
|
!(req->r_flags & (CEPH_OSD_FLAG_FULL_TRY |
|
||||||
CEPH_OSD_FLAG_FULL_FORCE)) &&
|
CEPH_OSD_FLAG_FULL_FORCE)) &&
|
||||||
(ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) ||
|
(ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
|
||||||
pool_full(osdc, req->r_t.base_oloc.pool))) {
|
pool_full(osdc, req->r_t.base_oloc.pool))) {
|
||||||
dout("req %p full/pool_full\n", req);
|
dout("req %p full/pool_full\n", req);
|
||||||
pr_warn_ratelimited("FULL or reached pool quota\n");
|
pr_warn_ratelimited("FULL or reached pool quota\n");
|
||||||
|
@ -2280,7 +2279,7 @@ static void send_linger_ping(struct ceph_osd_linger_request *lreq)
|
||||||
struct ceph_osd_request *req = lreq->ping_req;
|
struct ceph_osd_request *req = lreq->ping_req;
|
||||||
struct ceph_osd_req_op *op = &req->r_ops[0];
|
struct ceph_osd_req_op *op = &req->r_ops[0];
|
||||||
|
|
||||||
if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD)) {
|
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD)) {
|
||||||
dout("%s PAUSERD\n", __func__);
|
dout("%s PAUSERD\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3050,7 +3049,7 @@ static int handle_one_map(struct ceph_osd_client *osdc,
|
||||||
bool skipped_map = false;
|
bool skipped_map = false;
|
||||||
bool was_full;
|
bool was_full;
|
||||||
|
|
||||||
was_full = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL);
|
was_full = ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL);
|
||||||
set_pool_was_full(osdc);
|
set_pool_was_full(osdc);
|
||||||
|
|
||||||
if (incremental)
|
if (incremental)
|
||||||
|
@ -3088,7 +3087,7 @@ static int handle_one_map(struct ceph_osd_client *osdc,
|
||||||
osdc->osdmap = newmap;
|
osdc->osdmap = newmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
was_full &= !ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL);
|
was_full &= !ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL);
|
||||||
scan_requests(&osdc->homeless_osd, skipped_map, was_full, true,
|
scan_requests(&osdc->homeless_osd, skipped_map, was_full, true,
|
||||||
need_resend, need_resend_linger);
|
need_resend, need_resend_linger);
|
||||||
|
|
||||||
|
@ -3174,9 +3173,9 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
|
||||||
if (ceph_check_fsid(osdc->client, &fsid) < 0)
|
if (ceph_check_fsid(osdc->client, &fsid) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
was_pauserd = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD);
|
was_pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD);
|
||||||
was_pausewr = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSEWR) ||
|
was_pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) ||
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) ||
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
|
||||||
have_pool_full(osdc);
|
have_pool_full(osdc);
|
||||||
|
|
||||||
/* incremental maps */
|
/* incremental maps */
|
||||||
|
@ -3238,9 +3237,9 @@ done:
|
||||||
* we find out when we are no longer full and stop returning
|
* we find out when we are no longer full and stop returning
|
||||||
* ENOSPC.
|
* ENOSPC.
|
||||||
*/
|
*/
|
||||||
pauserd = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSERD);
|
pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD);
|
||||||
pausewr = ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_PAUSEWR) ||
|
pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) ||
|
||||||
ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL) ||
|
ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
|
||||||
have_pool_full(osdc);
|
have_pool_full(osdc);
|
||||||
if (was_pauserd || was_pausewr || pauserd || pausewr)
|
if (was_pauserd || was_pausewr || pauserd || pausewr)
|
||||||
maybe_request_map(osdc);
|
maybe_request_map(osdc);
|
||||||
|
|
Loading…
Reference in a new issue